Be smarter about showing update checks

This commit is contained in:
Matt Nadareski
2021-12-30 21:00:01 -08:00
parent 9effcc403d
commit 1d930d36bf
2 changed files with 7 additions and 4 deletions

View File

@@ -9,6 +9,7 @@
- Add horizontal scroll to user input
- Tweak new disc information fields and tabs
- Allow internal serial and volume label to be hidden
- Be smarter about showing update checks
### 2.2 (2021-12-30)
- Fix Saturn header finding

View File

@@ -86,7 +86,7 @@ namespace MPF.GUI.ViewModels
// Check for updates, if necessary
if (App.Options.CheckForUpdatesOnStartup)
CheckForUpdates();
CheckForUpdates(showIfSame: false);
}
#region Population
@@ -209,7 +209,8 @@ namespace MPF.GUI.ViewModels
/// <summary>
/// Check for available updates
/// </summary>
public void CheckForUpdates()
/// <param name="showIfSame">True to show the box even if it's the same, false to only show if it's different</param>
public void CheckForUpdates(bool showIfSame)
{
(bool different, string message, string url) = Tools.CheckForNewVersion();
@@ -221,7 +222,8 @@ namespace MPF.GUI.ViewModels
if (url == null)
message = "An exception occurred while checking for versions, please try again later. See the log window for more details.";
CustomMessageBox.Show(App.Instance, message, "Version Update Check", MessageBoxButton.OK, different ? MessageBoxImage.Exclamation : MessageBoxImage.Information);
if (showIfSame || different)
CustomMessageBox.Show(App.Instance, message, "Version Update Check", MessageBoxButton.OK, different ? MessageBoxImage.Exclamation : MessageBoxImage.Information);
}
/// <summary>
@@ -1247,7 +1249,7 @@ namespace MPF.GUI.ViewModels
/// Handler for CheckForUpdatesMenuItem Click event
/// </summary>
private void CheckForUpdatesClick(object sender, RoutedEventArgs e) =>
CheckForUpdates();
CheckForUpdates(showIfSame: true);
/// <summary>
/// Handler for OptionsMenuItem Click event