From 70dc3bae4aacb9490e4dbf422a79935d9e200595 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Fri, 23 Dec 2016 20:24:28 +0300 Subject: [PATCH] Dependent checkboxes --- .../Overlays/Options/General/LoginOptions.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index a5e21e2c47..c0d4784349 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -80,11 +80,22 @@ namespace osu.Game.Overlays.Options.General private PasswordTextBox password; private APIAccess api; + private CheckBoxOption saveUsername; + private CheckBoxOption savePassword; private void performLogin() { if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(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)] @@ -110,12 +121,12 @@ namespace osu.Game.Overlays.Options.General Height = 20, RelativeSizeAxes = Axes.X }, - new CheckBoxOption + saveUsername = new CheckBoxOption { LabelText = "Remember Username", Bindable = config.GetBindable(OsuConfig.SaveUsername), }, - new CheckBoxOption + savePassword = new CheckBoxOption { LabelText = "Remember Password", Bindable = config.GetBindable(OsuConfig.SavePassword), @@ -133,6 +144,7 @@ namespace osu.Game.Overlays.Options.General //Action = registerLink } }; + dependentChecking(saveUsername, savePassword); } } }