Skip to content

Commit

Permalink
Fix window position persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
rguida committed May 20, 2024
1 parent d5a18dd commit 6b73a44
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions MMExNotifier/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Drawing = System.Drawing;
using System.Reflection;
using WpfUi = Wpf.Ui.Controls;
using System.ComponentModel;

namespace MMExNotifier
{
Expand All @@ -29,10 +30,8 @@ private void Settings_Click(object sender, RoutedEventArgs e)
settingsPanel.Visibility = Visibility.Visible;
}

private void Close_Click(object sender, RoutedEventArgs e)
protected override void OnClosing(CancelEventArgs e)
{
Close();

Properties.Settings.Default.WindowPosition = new Drawing.Point((int)Left, (int)Top);
Properties.Settings.Default.WindowSize = new Drawing.Size((int)Width, (int)Height);
Properties.Settings.Default.Save();
Expand Down Expand Up @@ -69,7 +68,7 @@ private void TitleBar_HelpClicked(WpfUi.TitleBar sender, RoutedEventArgs args)
$"Version {appVersion}\n\n" +
"This software is provided free of charge and may be used, copied, and distributed without restriction.";

System.Windows.MessageBox.Show(this, aboutMessage, "About MMExNotifier", MessageBoxButton.OK, MessageBoxImage.Information);
MessageBox.Show(this, aboutMessage, "About MMExNotifier", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}

0 comments on commit 6b73a44

Please sign in to comment.