90 lines
2.4 KiB
C#
90 lines
2.4 KiB
C#
using System;
|
|
using System.Windows;
|
|
using Microsoft.Win32;
|
|
|
|
namespace JD.Perforce
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for P4EditConfiguration.xaml
|
|
/// </summary>
|
|
public partial class P4EditConfiguration : Window
|
|
{
|
|
public string Port
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
public string User
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
public string Client
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public new MessageBoxResult DialogResult
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public P4EditConfiguration()
|
|
{
|
|
InitializeComponent();
|
|
DialogResult = MessageBoxResult.None;
|
|
|
|
PortTextBlock.Focus();
|
|
}
|
|
|
|
private void OKButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
DialogResult = MessageBoxResult.OK;
|
|
this.Close();
|
|
}
|
|
|
|
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
DialogResult = MessageBoxResult.Cancel;
|
|
this.Close();
|
|
}
|
|
|
|
private void PortTextBlock_Changed(object sender, RoutedEventArgs e)
|
|
{
|
|
Port = PortTextBlock.Text;
|
|
}
|
|
|
|
private void UserTextBlock_Changed(object sender, RoutedEventArgs e)
|
|
{
|
|
User = UserTextBlock.Text;
|
|
}
|
|
|
|
private void ClientTextBlock_Changed(object sender, RoutedEventArgs e)
|
|
{
|
|
Client = ClientTextBlock.Text;
|
|
}
|
|
|
|
private void DefaultConfigCheckBox_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
//Get default settings from environment
|
|
PortTextBlock.IsReadOnly = true;
|
|
UserTextBlock.IsReadOnly = true;
|
|
ClientTextBlock.IsReadOnly = true;
|
|
|
|
RegistryKey subKey = Registry.CurrentUser.OpenSubKey("Software\\Perforce\\Environment\\");
|
|
|
|
PortTextBlock.Text = (string)subKey.GetValue("P4PORT", "Not set");
|
|
UserTextBlock.Text = (string)subKey.GetValue("P4USER", "Not set");
|
|
ClientTextBlock.Text = (string)subKey.GetValue("P4CLIENT", "Not set");
|
|
}
|
|
|
|
private void DefaultConfigCheckBox_Unchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
PortTextBlock.IsReadOnly = false;
|
|
UserTextBlock.IsReadOnly = false;
|
|
ClientTextBlock.IsReadOnly = false;
|
|
}
|
|
}
|
|
}
|