From b7ac38ca993c78c5f8064716eea288649afca0e6 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 5 Feb 2024 16:35:08 +0100 Subject: [PATCH] startup window size sanity check --- src/BreCalClient/App.xaml | 2 +- src/BreCalClient/App.xaml.cs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/BreCalClient/App.xaml b/src/BreCalClient/App.xaml index e74dc10..376a37a 100644 --- a/src/BreCalClient/App.xaml +++ b/src/BreCalClient/App.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:BreCalClient" - StartupUri="MainWindow.xaml" Exit="Application_Exit"> + StartupUri="MainWindow.xaml" Exit="Application_Exit" Startup="Application_Startup" > diff --git a/src/BreCalClient/App.xaml.cs b/src/BreCalClient/App.xaml.cs index 191a183..c4407b8 100644 --- a/src/BreCalClient/App.xaml.cs +++ b/src/BreCalClient/App.xaml.cs @@ -1,4 +1,5 @@ using BreCalClient.misc.Model; +using BreCalClient.Properties; using System.Windows; namespace BreCalClient @@ -14,5 +15,20 @@ namespace BreCalClient { BreCalClient.Properties.Settings.Default.Save(); } + + private void Application_Startup(object sender, StartupEventArgs e) + { + // Window size sanity check + if(Settings.Default.Width == 0) + { + Settings.Default.Width = 800; + Settings.Default.Save(); + } + if(Settings.Default.Height == 0) + { + Settings.Default.Height = 450; + Settings.Default.Save(); + } + } } }