private void buttonOK_Click(object sender, RoutedEventArgs e) { if (BindingValidator.IsValid(this)) { _clientLogic.TestCreateTestIndex(_context.Id, _testData); } }
private void buttonOK_Click(object sender, RoutedEventArgs e) { // enable validation on OK _contextValidation.ValidationEnabled = true; if (BindingValidator.IsValid(this)) { SaveToScript(); DialogResult = true; } }
private void buttonOK_Click(object sender, RoutedEventArgs e) { _contextValidation.ValidationEnabled = true; if (BindingValidator.IsValid(tabItemAdvanced)) { if (proxySettingsControl.IsValid) { // update proxy settings - dialog will close when complete StackHashProxySettings proxySettings = new StackHashProxySettings(); proxySettings.UseProxy = proxySettingsControl.ProxySettings.UseProxy; proxySettings.UseProxyAuthentication = proxySettingsControl.ProxySettings.UseProxyAuthentication; proxySettings.ProxyHost = proxySettingsControl.ProxySettings.ProxyHost; proxySettings.ProxyPort = proxySettingsControl.ProxySettings.ProxyPort; proxySettings.ProxyUserName = proxySettingsControl.ProxySettings.ProxyUsername; proxySettings.ProxyPassword = proxySettingsControl.ProxySettings.ProxyPassword; proxySettings.ProxyDomain = proxySettingsControl.ProxySettings.ProxyDomain; _clientLogic.ServiceProxySettings = proxySettings; _clientLogic.ClientTimeoutInSeconds = _contextValidation.ClientTimeoutInMinutes * 60; _clientLogic.AdminUpdateServiceProxySettingsAndClientTimeout(); } else { // if necessary select the proxy tab and highlight the error if (tabControl.SelectedItem != tabItemProxyServer) { tabControl.SelectedItem = tabItemProxyServer; bool unused = proxySettingsControl.IsValid; } } } else { // advanced tab not valid if (tabControl.SelectedItem != tabItemAdvanced) { tabControl.SelectedItem = tabItemAdvanced; bool unused = BindingValidator.IsValid(tabItemAdvanced); } } }
private void buttonManageProfiles_Click(object sender, RoutedEventArgs e) { if (_clientLogic.ServiceIsLocal) { // enable validation on OK _contextValidation.ValidationEnabled = true; if (BindingValidator.IsValid(tabItemServiceConnection)) { // need to update in case the user has changed the service details ServiceProxy.Services.UpdateServiceEndpointAndAccount(_contextValidation.ServiceHost, _contextValidation.ServicePort, UserSettings.Settings.ServiceUsername, UserSettings.Settings.ServicePassword, UserSettings.Settings.ServiceDomain); ProfileManager profileManager = new ProfileManager(_clientLogic); profileManager.Owner = this; profileManager.ShowDialog(); UpdateActiveContexts(); } else { // select and revalidate the service connection tab if necessary if (tabControl.SelectedItem != tabItemServiceConnection) { tabControl.SelectedItem = tabItemServiceConnection; BindingValidator.IsValid(tabItemServiceConnection); } } } else { StackHashMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Properties.Resources.ServiceOptionsUnavailable_MBMessage, _clientLogic.ServiceHost), Properties.Resources.ServiceOptionsUnavailable_MBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Information); } }
private void DoRefreshProfiles() { // enable validation on OK _contextValidation.ValidationEnabled = true; // validate the service connection tab - must be on this tab to click the refresh profiles button if (BindingValidator.IsValid(tabItemServiceConnection)) { // need to update in case the user has changed the service details ServiceProxy.Services.UpdateServiceEndpointAndAccount(_contextValidation.ServiceHost, _contextValidation.ServicePort, UserSettings.Settings.ServiceUsername, UserSettings.Settings.ServicePassword, UserSettings.Settings.ServiceDomain); _activeContexts.Clear(); _clientLogic.RefreshContextSettings(); } }
private void buttonOK_Click(object sender, RoutedEventArgs e) { // enable validation on OK _contextValidation.ValidationEnabled = true; bool valid = true; // check the proxy settings control if (valid) { if (!proxySettingsControl.IsValid) { valid = false; if (tabControl.SelectedItem != tabItemProxyServer) { tabControl.SelectedItem = tabItemProxyServer; // validate again to highlight error valid = proxySettingsControl.IsValid; } } } // check the display policy control if (valid) { if (!displayPolicyControl.IsValid) { valid = false; if (tabControl.SelectedItem != tabItemDefaultDisplayFilter) { tabControl.SelectedItem = tabItemDefaultDisplayFilter; // validate again to highlight error valid = displayPolicyControl.IsValid; } } } // check other tabs if (valid) { foreach (TabItem tab in tabControl.Items) { if (!BindingValidator.IsValid(tab)) { valid = false; // activate the bad tab if it's not the current one if (tabControl.SelectedItem != tab) { tabControl.SelectedItem = tab; // need to validate again to highlight errors BindingValidator.IsValid(tab); } break; } } } // prompt the user if a profile has not been selected if (valid) { if (!(comboBoxProfiles.SelectedItem is DisplayContext)) { if (StackHashMessageBox.Show(this, Properties.Resources.OptionsWindow_SelectProfileMBMessage, Properties.Resources.OptionsWindow_SelectProfileMBTitle, StackHashMessageBoxType.YesNo, StackHashMessageBoxIcon.Question) != StackHashDialogResult.Yes) { valid = false; tabControl.SelectedItem = tabItemServiceConnection; } else { UserSettings.Settings.CurrentContextId = -1; } } } if (valid) { UserSettings.Settings.DebuggerPathX86 = _contextValidation.DebuggerPathX86; UserSettings.Settings.DebuggerPathAmd64 = _contextValidation.DebuggerPathAmd64; UserSettings.Settings.DebuggerPathVisualStudio = _contextValidation.DebuggerPathVisualStudio; UserSettings.Settings.DefaultDebugTool = _contextValidation.DefaultDebugger; UserSettings.Settings.DiagnosticLogEnabled = _contextValidation.DiagnosticLogEnabled; UserSettings.Settings.ServiceHost = _contextValidation.ServiceHost; UserSettings.Settings.ServicePort = _contextValidation.ServicePort; UserSettings.Settings.EventPageSize = _contextValidation.EventsPerPage; // save proxy server settings UserSettings.Settings.UseProxyServer = proxySettingsControl.ProxySettings.UseProxy; UserSettings.Settings.UseProxyServerAuthentication = proxySettingsControl.ProxySettings.UseProxyAuthentication; UserSettings.Settings.ProxyHost = proxySettingsControl.ProxySettings.ProxyHost; UserSettings.Settings.ProxyPort = proxySettingsControl.ProxySettings.ProxyPort; UserSettings.Settings.ProxyUsername = proxySettingsControl.ProxySettings.ProxyUsername; UserSettings.Settings.ProxyPassword = proxySettingsControl.ProxySettings.ProxyPassword; UserSettings.Settings.ProxyDomain = proxySettingsControl.ProxySettings.ProxyDomain; // save default display policy UserSettings.Settings.SetDisplayHitThreshold(UserSettings.DefaultDisplayFilterProductId, displayPolicyControl.GetHitThreshold()); DialogResult = true; } }