Skip to content

Commit

Permalink
Added precalculation of the (hopefully ideal resolution to load image…
Browse files Browse the repository at this point in the history
…s with)
  • Loading branch information
Luca Auer authored and Luca Auer committed Sep 3, 2018
1 parent ea0f5c9 commit 3081242
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Image sort.UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3081242

Please sign in to comment.