CheckLogin() public method

public CheckLogin ( bool check ) : void
check bool
return void
Example #1
0
        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 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();
        }
 partial void OnRequireAuth(NSObject sender)
 {
     Controller.CheckLogin(this.RequiresAuthorizationCheckBox.State == NSCellStateValue.On);
 }
Example #4
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;
            };
        }
        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;
            };

        }
        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();
        }