private ApplicationSettingsWindow(string DefaultServerAndPort, string DefaultUserName, bool bUnstable, string OriginalExecutableFileName, UserSettings Settings, TextWriter Log) { InitializeComponent(); this.OriginalExecutableFileName = OriginalExecutableFileName; this.Settings = Settings; this.Log = Log; Utility.ReadGlobalPerforceSettings(ref InitialServerAndPort, ref InitialUserName, ref InitialDepotPath); bInitialUnstable = bUnstable; InitialAutomationPortNumber = AutomationServer.GetPortNumber(); InitialProtocolHandlerState = ProtocolHandlerUtils.GetState(); this.AutomaticallyRunAtStartupCheckBox.Checked = IsAutomaticallyRunAtStartup(); this.KeepInTrayCheckBox.Checked = Settings.bKeepInTray; this.ServerTextBox.Text = InitialServerAndPort; this.ServerTextBox.Select(ServerTextBox.TextLength, 0); this.ServerTextBox.CueBanner = (DefaultServerAndPort == null)? "Default" : String.Format("Default ({0})", DefaultServerAndPort); this.UserNameTextBox.Text = InitialUserName; this.UserNameTextBox.Select(UserNameTextBox.TextLength, 0); this.UserNameTextBox.CueBanner = (DefaultUserName == null)? "Default" : String.Format("Default ({0})", DefaultUserName); this.ParallelSyncThreadsSpinner.Value = Math.Max(Math.Min(Settings.SyncOptions.NumThreads, ParallelSyncThreadsSpinner.Maximum), ParallelSyncThreadsSpinner.Minimum); this.DepotPathTextBox.Text = InitialDepotPath; this.DepotPathTextBox.Select(DepotPathTextBox.TextLength, 0); this.DepotPathTextBox.CueBanner = DeploymentSettings.DefaultDepotPath; this.UseUnstableBuildCheckBox.Checked = bUnstable; if (InitialAutomationPortNumber > 0) { this.EnableAutomationCheckBox.Checked = true; this.AutomationPortTextBox.Enabled = true; this.AutomationPortTextBox.Text = InitialAutomationPortNumber.ToString(); } else { this.EnableAutomationCheckBox.Checked = false; this.AutomationPortTextBox.Enabled = false; this.AutomationPortTextBox.Text = AutomationServer.DefaultPortNumber.ToString(); } if (InitialProtocolHandlerState == ProtocolHandlerState.Installed) { this.EnableProtocolHandlerCheckBox.CheckState = CheckState.Checked; } else if (InitialProtocolHandlerState == ProtocolHandlerState.NotInstalled) { this.EnableProtocolHandlerCheckBox.CheckState = CheckState.Unchecked; } else { this.EnableProtocolHandlerCheckBox.CheckState = CheckState.Indeterminate; } }
private ApplicationSettingsWindow(string DefaultServerAndPort, string DefaultUserName, bool bUnstable, string OriginalExecutableFileName, UserSettings Settings, TextWriter Log) { InitializeComponent(); this.OriginalExecutableFileName = OriginalExecutableFileName; this.Settings = Settings; this.Log = Log; Utility.ReadGlobalPerforceSettings(ref InitialServerAndPort, ref InitialUserName, ref InitialDepotPath); bInitialUnstable = bUnstable; InitialAutomationPortNumber = AutomationServer.GetPortNumber(); this.AutomaticallyRunAtStartupCheckBox.Checked = IsAutomaticallyRunAtStartup(); this.KeepInTrayCheckBox.Checked = Settings.bKeepInTray; this.ServerTextBox.Text = InitialServerAndPort; this.ServerTextBox.Select(ServerTextBox.TextLength, 0); this.ServerTextBox.CueBanner = (DefaultServerAndPort == null)? "Default" : String.Format("Default ({0})", DefaultServerAndPort); this.UserNameTextBox.Text = InitialUserName; this.UserNameTextBox.Select(UserNameTextBox.TextLength, 0); this.UserNameTextBox.CueBanner = (DefaultUserName == null)? "Default" : String.Format("Default ({0})", DefaultUserName); this.DepotPathTextBox.Text = InitialDepotPath; this.DepotPathTextBox.Select(DepotPathTextBox.TextLength, 0); this.DepotPathTextBox.CueBanner = DeploymentSettings.DefaultDepotPath; this.UseUnstableBuildCheckBox.Checked = bUnstable; if (InitialAutomationPortNumber > 0) { this.EnableAutomationCheckBox.Checked = true; this.AutomationPortTextBox.Enabled = true; this.AutomationPortTextBox.Text = InitialAutomationPortNumber.ToString(); } else { this.EnableAutomationCheckBox.Checked = false; this.AutomationPortTextBox.Enabled = false; this.AutomationPortTextBox.Text = AutomationServer.DefaultPortNumber.ToString(); } }