From 3081242367f4da8134d3eca44b9bfbc6c90ae030 Mon Sep 17 00:00:00 2001 From: Luca Auer Date: Mon, 3 Sep 2018 21:45:38 +0200 Subject: [PATCH] Added precalculation of the (hopefully ideal resolution to load images with) --- Image sort.UI/MainWindow.xaml.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Image sort.UI/MainWindow.xaml.cs b/Image sort.UI/MainWindow.xaml.cs index 5229cf11..a4fbf98d 100644 --- a/Image sort.UI/MainWindow.xaml.cs +++ b/Image sort.UI/MainWindow.xaml.cs @@ -1935,8 +1935,32 @@ private async void MetroWindow_Loaded(object sender, RoutedEventArgs e) // Open the help window helpWindow.Show(); + + // the next run isn't a first run anymore Properties.Settings.Default.FirstRun = false; Properties.Settings.Default.Save(); + + // calculate the ideal resolution to load images with. + int biggestHorizontalRes = 0; + + // take the biggest usable resolution from the biggest + // screen for the setting to load images. + foreach (var screen in Screen.AllScreens) + { + int usableScreenWidth = screen.WorkingArea.Width; + if (usableScreenWidth > biggestHorizontalRes) + { + biggestHorizontalRes = usableScreenWidth; + } + } + + // apply the resolution if it is relistic. + // (360p screen is the smallest resolution i've ever seen + // a screen with this musn't run on the game boy) + if (biggestHorizontalRes > 359) + { + MaxHorizontalResolution = biggestHorizontalRes; + } #if !DEBUG_HELP } #endif