1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 14:53:01 +08:00

Dependent checkboxes

This commit is contained in:
Andrey Zavadskiy 2016-12-23 20:24:28 +03:00
parent cd3ab33d08
commit 70dc3bae4a

View File

@ -80,11 +80,22 @@ namespace osu.Game.Overlays.Options.General
private PasswordTextBox password; private PasswordTextBox password;
private APIAccess api; private APIAccess api;
private CheckBoxOption saveUsername;
private CheckBoxOption savePassword;
private void performLogin() private void performLogin()
{ {
if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text)) if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text))
api.Login(username.Text, password.Text); api.Login(username.Text, password.Text);
}
private void dependentChecking(CheckBoxOption saveUsername, CheckBoxOption savePassword)
{
if (savePassword.State == CheckBoxState.Checked)
{
saveUsername.State = CheckBoxState.Checked;
}
} }
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
@ -110,12 +121,12 @@ namespace osu.Game.Overlays.Options.General
Height = 20, Height = 20,
RelativeSizeAxes = Axes.X RelativeSizeAxes = Axes.X
}, },
new CheckBoxOption saveUsername = new CheckBoxOption
{ {
LabelText = "Remember Username", LabelText = "Remember Username",
Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername), Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername),
}, },
new CheckBoxOption savePassword = new CheckBoxOption
{ {
LabelText = "Remember Password", LabelText = "Remember Password",
Bindable = config.GetBindable<bool>(OsuConfig.SavePassword), Bindable = config.GetBindable<bool>(OsuConfig.SavePassword),
@ -133,6 +144,7 @@ namespace osu.Game.Overlays.Options.General
//Action = registerLink //Action = registerLink
} }
}; };
dependentChecking(saveUsername, savePassword);
} }
} }
} }