Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: the main window is now automatically opened on the first start. #3

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions MMExNotifier/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
11 changes: 5 additions & 6 deletions MMExNotifier/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Icon="pack://application:,,,/Resources/MMExNotifier.png"
ResizeMode="CanResizeWithGrip"
Visibility="Hidden"
WindowBackdropType="Mica"
WindowCornerPreference="Round"
WindowStartupLocation="Manual"
Expand Down Expand Up @@ -278,11 +277,6 @@
</Button>
</Grid>

<CheckBox
Margin="20"
Content="Run MMExNotifier on Windows logon"
IsChecked="{Binding Path=AppSettings.RunAtLogon}" />

<Grid Margin="20,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
Expand Down Expand Up @@ -327,6 +321,11 @@
Content="days ahead" />
</Grid>

<CheckBox
Margin="20"
Content="Run MMExNotifier on Windows logon"
IsChecked="{Binding Path=AppSettings.RunAtLogon}" />

</StackPanel>
</Border>
</Grid>
Expand Down
Loading