예제 #1
0
        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);
                }
            }
        }