diff --git a/Flow.Launcher/Resources/Pages/WelcomePage1.xaml.cs b/Flow.Launcher/Resources/Pages/WelcomePage1.xaml.cs index 1b1dd21e9..3199e81b7 100644 --- a/Flow.Launcher/Resources/Pages/WelcomePage1.xaml.cs +++ b/Flow.Launcher/Resources/Pages/WelcomePage1.xaml.cs @@ -14,10 +14,14 @@ namespace Flow.Launcher.Resources.Pages protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { Settings = Ioc.Default.GetRequiredService(); _viewModel = Ioc.Default.GetRequiredService(); + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click, diff --git a/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs b/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs index 7408d8a14..1eef9fc8c 100644 --- a/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs +++ b/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs @@ -16,10 +16,14 @@ namespace Flow.Launcher.Resources.Pages protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { Settings = Ioc.Default.GetRequiredService(); _viewModel = Ioc.Default.GetRequiredService(); + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click, diff --git a/Flow.Launcher/Resources/Pages/WelcomePage3.xaml.cs b/Flow.Launcher/Resources/Pages/WelcomePage3.xaml.cs index bd14bf0f7..d27368aa1 100644 --- a/Flow.Launcher/Resources/Pages/WelcomePage3.xaml.cs +++ b/Flow.Launcher/Resources/Pages/WelcomePage3.xaml.cs @@ -12,10 +12,14 @@ namespace Flow.Launcher.Resources.Pages protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { Settings = Ioc.Default.GetRequiredService(); _viewModel = Ioc.Default.GetRequiredService(); + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click, diff --git a/Flow.Launcher/Resources/Pages/WelcomePage4.xaml.cs b/Flow.Launcher/Resources/Pages/WelcomePage4.xaml.cs index b20e4ce0a..b0999504b 100644 --- a/Flow.Launcher/Resources/Pages/WelcomePage4.xaml.cs +++ b/Flow.Launcher/Resources/Pages/WelcomePage4.xaml.cs @@ -12,10 +12,14 @@ namespace Flow.Launcher.Resources.Pages protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { Settings = Ioc.Default.GetRequiredService(); _viewModel = Ioc.Default.GetRequiredService(); + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click, diff --git a/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs b/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs index 84d298966..2ece4ce88 100644 --- a/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs +++ b/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs @@ -15,10 +15,14 @@ namespace Flow.Launcher.Resources.Pages protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { Settings = Ioc.Default.GetRequiredService(); _viewModel = Ioc.Default.GetRequiredService(); + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click, diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml.cs index 93515caec..00426546a 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml.cs @@ -12,11 +12,15 @@ public partial class SettingsPaneAbout protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { _viewModel = Ioc.Default.GetRequiredService(); _settingViewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click, diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml.cs index fa3406bd9..524e4f5f5 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml.cs @@ -12,11 +12,15 @@ public partial class SettingsPaneGeneral protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { _viewModel = Ioc.Default.GetRequiredService(); _settingViewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click, diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml.cs index e590dc9a8..53a639aa5 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml.cs @@ -12,11 +12,15 @@ public partial class SettingsPaneHotkey protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { _viewModel = Ioc.Default.GetRequiredService(); _settingViewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click, diff --git a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs index aa6900dae..34cd33ec1 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs @@ -15,11 +15,15 @@ public partial class SettingsPanePluginStore protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { _viewModel = Ioc.Default.GetRequiredService(); _settingViewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; + } + if (!IsInitialized) + { InitializeComponent(); } _viewModel.PropertyChanged += ViewModel_PropertyChanged; diff --git a/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs index 6424aabdf..94e0d24a2 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs @@ -15,11 +15,15 @@ public partial class SettingsPanePlugins protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { _viewModel = Ioc.Default.GetRequiredService(); _settingViewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; + } + if (!IsInitialized) + { InitializeComponent(); } _viewModel.PropertyChanged += ViewModel_PropertyChanged; diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml.cs index c89a050f5..aa47383e8 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml.cs @@ -12,11 +12,15 @@ public partial class SettingsPaneProxy protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { _viewModel = Ioc.Default.GetRequiredService(); _settingViewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click, diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs index 8759c8efc..215a8c70c 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs @@ -12,11 +12,15 @@ public partial class SettingsPaneTheme protected override void OnNavigatedTo(NavigationEventArgs e) { + // If the navigation is not triggered by button click, view model will be null again if (_viewModel == null) { _viewModel = Ioc.Default.GetRequiredService(); _settingViewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; + } + if (!IsInitialized) + { InitializeComponent(); } // Sometimes the navigation is not triggered by button click,