From 5e2ec0bd27b2c968c79c13013dabc946c0252d53 Mon Sep 17 00:00:00 2001 From: Roberto <107645954+intcooper@users.noreply.github.com> Date: Tue, 21 May 2024 18:49:10 +0200 Subject: [PATCH] Bug fix: the main window is now automatically opened on the first start. Change: the option to start at logon is now the last one. --- MMExNotifier/App.xaml.cs | 12 ++++++++++-- MMExNotifier/Views/MainWindow.xaml | 11 +++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/MMExNotifier/App.xaml.cs b/MMExNotifier/App.xaml.cs index 78738d9..a3e8f8a 100644 --- a/MMExNotifier/App.xaml.cs +++ b/MMExNotifier/App.xaml.cs @@ -20,9 +20,17 @@ protected override void OnStartup(StartupEventArgs e) var view = new MainWindow(); var viewModel = new MainViewModel(appConfiguration, new NotificationService(new ToastNotification()), new DatabaseService(appConfiguration)); + view.Hide(); view.DataContext = viewModel; - viewModel.OnClose += (s, e) => Application.Current.Dispatcher.Invoke(() => view.Close()); - viewModel.OnOpen += (s, e) => Application.Current.Dispatcher.Invoke(() => { if (view.Visibility != Visibility.Visible) view.ShowDialog(); }); + viewModel.OnClose += (s, e) => view.Dispatcher.Invoke(() => view.Close()); + viewModel.OnOpen += (s, e) => view.Dispatcher.Invoke(() => + { + if (view.Visibility != Visibility.Visible) + { + view.Visibility = Visibility.Visible; + view.Show(); + } + }); viewModel.Activate(); } } diff --git a/MMExNotifier/Views/MainWindow.xaml b/MMExNotifier/Views/MainWindow.xaml index 45e8242..d1b5dba 100644 --- a/MMExNotifier/Views/MainWindow.xaml +++ b/MMExNotifier/Views/MainWindow.xaml @@ -20,7 +20,6 @@ Foreground="{DynamicResource TextFillColorPrimaryBrush}" Icon="pack://application:,,,/Resources/MMExNotifier.png" ResizeMode="CanResizeWithGrip" - Visibility="Hidden" WindowBackdropType="Mica" WindowCornerPreference="Round" WindowStartupLocation="Manual" @@ -278,11 +277,6 @@ - - @@ -327,6 +321,11 @@ Content="days ahead" /> + +