From 1b3049fbdbabcc7fc52e620ddfb7678a93e4b5dc Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 23 Jul 2023 17:39:46 +0100 Subject: [PATCH] Make FastFlag editor state consistent with reloads --- .../Elements/Menu/Pages/FastFlagEditorPage.xaml.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs index 2bee58a..bb2f059 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs +++ b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs @@ -16,13 +16,14 @@ namespace Bloxstrap.UI.Elements.Menu.Pages // using a datagrid is a codebehind thing only and thats it theres literally no way around it private readonly ObservableCollection _fastFlagList = new(); + private bool _showPresets = false; public FastFlagEditorPage() { InitializeComponent(); } - private void ReloadList(bool showPresets = false) + private void ReloadList() { _fastFlagList.Clear(); @@ -30,7 +31,7 @@ namespace Bloxstrap.UI.Elements.Menu.Pages foreach (var pair in App.FastFlags.Prop) { - if (!showPresets && presetFlags.Contains(pair.Key)) + if (!_showPresets && presetFlags.Contains(pair.Key)) continue; var entry = new FastFlag @@ -131,8 +132,11 @@ namespace Bloxstrap.UI.Elements.Menu.Pages private void ToggleButton_Click(object sender, RoutedEventArgs e) { - if (sender is ToggleButton button) - ReloadList(button.IsChecked ?? false); + if (sender is not ToggleButton button) + return; + + _showPresets = button.IsChecked ?? false; + ReloadList(); } } }