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