diff --git a/osu.Game/Overlays/Options/CheckBoxOption.cs b/osu.Game/Overlays/Options/CheckBoxOption.cs index 3958f65be5..4d505ca625 100644 --- a/osu.Game/Overlays/Options/CheckBoxOption.cs +++ b/osu.Game/Overlays/Options/CheckBoxOption.cs @@ -1,53 +1,54 @@ -using System; +using System; using osu.Framework.Configuration; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options -{ - public class CheckBoxOption : BasicCheckBox - { - private Bindable bindable; - - public Bindable Bindable - { - set - { - if (bindable != null) - bindable.ValueChanged -= bindableValueChanged; - bindable = value; - if (bindable != null) +namespace osu.Game.Overlays.Options +{ + public class CheckBoxOption : BasicCheckBox + { + private Bindable bindable; + + public Bindable Bindable + { + set + { + if (bindable != null) + bindable.ValueChanged -= bindableValueChanged; + bindable = value; + if (bindable != null) { bool state = State == CheckBoxState.Checked; if (state != bindable.Value) State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; - bindable.ValueChanged += bindableValueChanged; - } - } + bindable.ValueChanged += bindableValueChanged; + } + } } - private void bindableValueChanged(object sender, EventArgs e) - { - State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; - } - + + private void bindableValueChanged(object sender, EventArgs e) + { + State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; + } + protected override void Dispose(bool isDisposing) - { - if (bindable != null) + { + if (bindable != null) bindable.ValueChanged -= bindableValueChanged; base.Dispose(isDisposing); - } - + } + protected override void OnChecked() - { - if (bindable != null) + { + if (bindable != null) bindable.Value = true; base.OnChecked(); - } - - protected override void OnUnchecked() - { - if (bindable != null) - bindable.Value = false; - base.OnChecked(); - } - } -} \ No newline at end of file + } + + protected override void OnUnchecked() + { + if (bindable != null) + bindable.Value = false; + base.OnUnchecked(); + } + } +}