From 5b32de8b9b138b6eb7bd05c1714eb4e7a204c96c Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Tue, 29 Oct 2024 20:45:12 +0000 Subject: [PATCH] move the viewmodel to a variable makes everything look cleaner --- .../Settings/Pages/FastFlagEditorWarningPage.xaml.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml.cs b/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml.cs index 6f35278..b04bb3d 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml.cs +++ b/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml.cs @@ -8,13 +8,14 @@ namespace Bloxstrap.UI.Elements.Settings.Pages /// public partial class FastFlagEditorWarningPage { + private FastFlagEditorWarningViewModel _viewModel; private bool _initialLoad = false; public FastFlagEditorWarningPage() { - var vm = new FastFlagEditorWarningViewModel(this); - DataContext = vm; - vm.StartCountdown(); + _viewModel = new FastFlagEditorWarningViewModel(this); + DataContext = _viewModel; + _viewModel.StartCountdown(); InitializeComponent(); } @@ -29,12 +30,12 @@ namespace Bloxstrap.UI.Elements.Settings.Pages return; } - ((FastFlagEditorWarningViewModel)DataContext).StartCountdown(); + _viewModel.StartCountdown(); } private void Page_Unloaded(object sender, RoutedEventArgs e) { - ((FastFlagEditorWarningViewModel)DataContext).StopCountdown(); + _viewModel.StopCountdown(); } } }