Controller for the Setting dialog.
Esempio n. 1
0
 private void CheckAddress(SettingController controller)
 {
     if (AddressText.IsEnabled)
     {
         controller.ValidateServer(AddressText.Text);
     }
     else
     {
         FinishButton.IsEnabled = true;
         AddressError.Text      = String.Empty;
     }
 }
Esempio n. 2
0
 private void CheckAddress(SettingController controller)
 {
     if (ProxyServer.Enabled)
     {
         controller.ValidateServer(ProxyServer.StringValue);
     }
     else
     {
         SaveButton.Enabled          = true;
         ProxyServerHelp.StringValue = String.Empty;
     }
 }
Esempio n. 3
0
 private void CheckAddress(SettingController controller)
 {
     if (AddressText.IsEnabled)
     {
         controller.ValidateServer(AddressText.Text);
     }
     else
     {
         FinishButton.IsEnabled = true;
         AddressError.Text = String.Empty;
     }
 }
Esempio n. 4
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();
            this.Title              = Properties_Resources.EditTitle;
            this.ProxySettings      = ConfigManager.CurrentConfig.Proxy;
            this.CancelButton.Title = Properties_Resources.DiscardChanges;
            this.SaveButton.Title   = Properties_Resources.SaveChanges;
            this.RequiresAuthorizationCheckBox.StringValue = Properties_Resources.NetworkProxyLogin;
            this.ProxyPasswordLabel.StringValue            = Properties_Resources.Password;
            this.ProxyUsernameLabel.StringValue            = Properties_Resources.User;
            this.NotificationsFeaturesButton.Title         = Properties_Resources.Notifications;

            Controller = (this.WindowController as GeneralSettingsController).Controller;

            this.ProxyServer.Delegate = new TextFieldDelegate();
            (this.ProxyServer.Delegate as TextFieldDelegate).StringValueChanged += delegate
            {
                Controller.ValidateServer(this.ProxyServer.StringValue);
            };


            Controller.CheckProxyNoneEvent += (check) =>
            {
                if (check != (NoProxyButton.State == NSCellStateValue.On))
                {
                    NoProxyButton.State = check ? NSCellStateValue.On : NSCellStateValue.Off;
                }
            };

            Controller.CheckProxySystemEvent += (check) =>
            {
                if (check != (SystemDefaultProxyButton.State == NSCellStateValue.On))
                {
                    SystemDefaultProxyButton.State = check ? NSCellStateValue.On : NSCellStateValue.Off;
                }
            };

            Controller.CheckProxyCutomEvent += (check) =>
            {
                if (check != (ManualProxyButton.State == NSCellStateValue.On))
                {
                    ManualProxyButton.State = check ? NSCellStateValue.On : NSCellStateValue.Off;
                }
                ProxyServerLabel.Enabled = check;
                ProxyServer.Enabled      = check;
                ProxyServerHelp.Enabled  = check;
                CheckAddress(Controller);
            };

            Controller.EnableLoginEvent += (enable) =>
            {
                RequiresAuthorizationCheckBox.Enabled = enable;
                if (enable)
                {
                    Controller.CheckLogin(RequiresAuthorizationCheckBox.State == NSCellStateValue.On);
                }
                else
                {
                    ProxyUsernameLabel.Enabled = false;
                    ProxyUsername.Enabled      = false;
                    ProxyPasswordLabel.Enabled = false;
                    ProxyPassword.Enabled      = false;
                }
            };

            Controller.CheckLoginEvent += (check) =>
            {
                if (check != (RequiresAuthorizationCheckBox.State == NSCellStateValue.On))
                {
                    RequiresAuthorizationCheckBox.State = check ? NSCellStateValue.On : NSCellStateValue.Off;
                }
                ProxyUsernameLabel.Enabled = check;
                ProxyUsername.Enabled      = check;
                ProxyPasswordLabel.Enabled = check;
                ProxyPassword.Enabled      = check;
            };

            Controller.UpdateServerHelpEvent += (message) =>
            {
                ProxyServerHelp.StringValue = message;
            };


            Controller.UpdateSaveEvent += (enable) =>
            {
                SaveButton.Enabled = enable;
            };

            RefreshStates();
        }
Esempio n. 5
0
        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;
            };
        }
Esempio n. 6
0
        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;
            };

        }
Esempio n. 7
0
        public override void AwakeFromNib ()
        {
            base.AwakeFromNib ();
            this.Title = Properties_Resources.EditTitle;
            this.ProxySettings = ConfigManager.CurrentConfig.Proxy;
            this.CancelButton.Title = Properties_Resources.DiscardChanges;
            this.SaveButton.Title = Properties_Resources.SaveChanges;
            this.RequiresAuthorizationCheckBox.StringValue = Properties_Resources.NetworkProxyLogin;
            this.ProxyPasswordLabel.StringValue = Properties_Resources.Password;
            this.ProxyUsernameLabel.StringValue = Properties_Resources.User;
            this.NotificationsFeaturesButton.Title = Properties_Resources.Notifications;

            Controller = (this.WindowController as GeneralSettingsController).Controller;

            this.ProxyServer.Delegate = new TextFieldDelegate ();
            (this.ProxyServer.Delegate as TextFieldDelegate).StringValueChanged += delegate
            {
                Controller.ValidateServer(this.ProxyServer.StringValue);
            };


            Controller.CheckProxyNoneEvent += (check) =>
            {
                if(check != (NoProxyButton.State == NSCellStateValue.On))
                {
                    NoProxyButton.State = check ? NSCellStateValue.On : NSCellStateValue.Off;
                }
            };

            Controller.CheckProxySystemEvent += (check) =>
            {
                if(check != (SystemDefaultProxyButton.State == NSCellStateValue.On))
                {
                    SystemDefaultProxyButton.State = check ? NSCellStateValue.On : NSCellStateValue.Off;
                }
            };

            Controller.CheckProxyCutomEvent += (check) =>
            {
                if(check != (ManualProxyButton.State == NSCellStateValue.On))
                {
                    ManualProxyButton.State = check ? NSCellStateValue.On : NSCellStateValue.Off;
                }
                ProxyServerLabel.Enabled = check;
                ProxyServer.Enabled = check;
                ProxyServerHelp.Enabled = check;
                CheckAddress(Controller);
            };

            Controller.EnableLoginEvent += (enable) =>
            {
                RequiresAuthorizationCheckBox.Enabled = enable;
                if (enable)
                {
                    Controller.CheckLogin(RequiresAuthorizationCheckBox.State == NSCellStateValue.On);
                }
                else
                {
                    ProxyUsernameLabel.Enabled = false;
                    ProxyUsername.Enabled = false;
                    ProxyPasswordLabel.Enabled = false;
                    ProxyPassword.Enabled = false;
                }
            };
            
            Controller.CheckLoginEvent += (check) =>
            {
                if (check != (RequiresAuthorizationCheckBox.State == NSCellStateValue.On))
                {
                    RequiresAuthorizationCheckBox.State = check ? NSCellStateValue.On : NSCellStateValue.Off;
                }
                ProxyUsernameLabel.Enabled = check;
                ProxyUsername.Enabled = check;
                ProxyPasswordLabel.Enabled = check;
                ProxyPassword.Enabled = check;
            };

            Controller.UpdateServerHelpEvent += (message) =>
            {
                ProxyServerHelp.StringValue = message;
            };


            Controller.UpdateSaveEvent += (enable) =>
            {
                SaveButton.Enabled = enable;
            };

            RefreshStates();
        }
Esempio n. 8
0
 private void CheckAddress(SettingController controller)
 {
     if (ProxyServer.Enabled)
     {
         controller.ValidateServer(ProxyServer.StringValue);
     }
     else
     {
         SaveButton.Enabled = true;
         ProxyServerHelp.StringValue = String.Empty;
     }
 }