partial void OnDefaultProxy(NSObject sender) { if (this.SystemDefaultProxyButton.State == NSCellStateValue.On) { Controller.CheckProxySystem(); } }
private void RefreshSetting() { AddressText.Text = ConfigManager.CurrentConfig.Proxy.Server == null ? "" : ((Uri)ConfigManager.CurrentConfig.Proxy.Server).ToString(); UserText.Text = ConfigManager.CurrentConfig.Proxy.Username == null ? "" : ConfigManager.CurrentConfig.Proxy.Username; PasswordText.Password = ConfigManager.CurrentConfig.Proxy.ObfuscatedPassword == null ? "" : Crypto.Deobfuscate(ConfigManager.CurrentConfig.Proxy.ObfuscatedPassword); Controller.CheckLogin(ConfigManager.CurrentConfig.Proxy.LoginRequired); switch (ConfigManager.CurrentConfig.Proxy.Selection) { case ProxySelection.NOPROXY: Controller.CheckProxyNone(); break; case ProxySelection.SYSTEM: Controller.CheckProxySystem(); break; case ProxySelection.CUSTOM: Controller.CheckProxyCustom(); break; default: break; } NotificationsCheck.IsChecked = ConfigManager.CurrentConfig.Notifications; FinishButton.Focus(); }
public void ApplyController(SettingController controller) { ProxyNone.Checked += delegate { controller.CheckProxyNone(); }; ProxySystem.Checked += delegate { controller.CheckProxySystem(); }; ProxyCustom.Checked += delegate { controller.CheckProxyCustom(); }; LoginCheck.Checked += delegate { controller.CheckLogin(true); }; LoginCheck.Unchecked += delegate { controller.CheckLogin(false); }; AddressText.TextChanged += delegate(object sender, TextChangedEventArgs e) { controller.ValidateServer(AddressText.Text); }; controller.CheckProxyNoneEvent += (check) => { if (check != ProxyNone.IsChecked) { ProxyNone.IsChecked = check; } }; controller.CheckProxySystemEvent += (check) => { if (check != ProxySystem.IsChecked) { ProxySystem.IsChecked = check; } }; controller.CheckProxyCutomEvent += (check) => { if (check != ProxyCustom.IsChecked) { ProxyCustom.IsChecked = check; } AddressText.IsEnabled = check; CheckAddress(controller); }; controller.EnableLoginEvent += (enable) => { LoginCheck.IsEnabled = enable; if (enable) { controller.CheckLogin(LoginCheck.IsChecked.GetValueOrDefault()); } else { UserText.IsEnabled = false; PasswordText.IsEnabled = false; } }; controller.CheckLoginEvent += (check) => { if (check != LoginCheck.IsChecked) { LoginCheck.IsChecked = check; } UserText.IsEnabled = check; PasswordText.IsEnabled = check; }; controller.UpdateServerHelpEvent += (message) => { AddressError.Text = message; }; controller.UpdateSaveEvent += (enable) => { FinishButton.IsEnabled = enable; }; }