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