mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Add on-startup "check for updates" option (fixes #302)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
- Update to Aaru v5.3.0-rc1
|
||||
- Update to BurnOutSharp 1.8.0
|
||||
- Update support packages
|
||||
- Add on-startup "check for updates" option
|
||||
|
||||
### 2.1 (2021-07-22)
|
||||
- Enum, no more
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MPF.Converters;
|
||||
using MPF.Utilities;
|
||||
using RedumpLib.Data;
|
||||
|
||||
namespace MPF.Data
|
||||
@@ -70,6 +69,15 @@ namespace MPF.Data
|
||||
set { _settings["EnableDarkMode"] = value.ToString(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check for updates on startup
|
||||
/// </summary>
|
||||
public bool CheckForUpdatesOnStartup
|
||||
{
|
||||
get { return GetBooleanSetting(_settings, "CheckForUpdatesOnStartup", true); }
|
||||
set { _settings["CheckForUpdatesOnStartup"] = value.ToString(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default output path for dumps
|
||||
/// </summary>
|
||||
|
||||
@@ -83,6 +83,10 @@ namespace MPF.GUI.ViewModels
|
||||
|
||||
// Finish initializing the rest of the values
|
||||
InitializeUIValues(removeEventHandlers: false, rescanDrives: true);
|
||||
|
||||
// Check for updates, if necessary
|
||||
if (App.Options.CheckForUpdatesOnStartup)
|
||||
CheckForUpdates();
|
||||
}
|
||||
|
||||
#region Population
|
||||
@@ -353,15 +357,15 @@ namespace MPF.GUI.ViewModels
|
||||
if (rescanDrives)
|
||||
{
|
||||
App.Instance.StatusLabel.Content = "Creating drive list, please wait!";
|
||||
await App.Instance.Dispatcher.InvokeAsync(() => PopulateDrives());
|
||||
await App.Instance.Dispatcher.InvokeAsync(PopulateDrives);
|
||||
}
|
||||
else
|
||||
{
|
||||
await App.Instance.Dispatcher.InvokeAsync(() => DetermineSystemType());
|
||||
await App.Instance.Dispatcher.InvokeAsync(DetermineSystemType);
|
||||
}
|
||||
|
||||
// Determine current media type, if possible
|
||||
await App.Instance.Dispatcher.InvokeAsync(() => PopulateMediaType());
|
||||
await App.Instance.Dispatcher.InvokeAsync(PopulateMediaType);
|
||||
CacheCurrentDiscType();
|
||||
SetCurrentDiscType();
|
||||
|
||||
|
||||
@@ -199,25 +199,20 @@ namespace MPF.GUI.ViewModels
|
||||
/// <summary>
|
||||
/// Create an open folder dialog box
|
||||
/// </summary>
|
||||
private FolderBrowserDialog CreateFolderBrowserDialog()
|
||||
{
|
||||
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
return dialog;
|
||||
}
|
||||
private static FolderBrowserDialog CreateFolderBrowserDialog() => new FolderBrowserDialog();
|
||||
|
||||
/// <summary>
|
||||
/// Create an open file dialog box
|
||||
/// </summary>
|
||||
private OpenFileDialog CreateOpenFileDialog()
|
||||
private static OpenFileDialog CreateOpenFileDialog()
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
|
||||
dialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||
dialog.Filter = "Executables (*.exe)|*.exe";
|
||||
dialog.FilterIndex = 0;
|
||||
dialog.RestoreDirectory = true;
|
||||
|
||||
return dialog;
|
||||
return new OpenFileDialog()
|
||||
{
|
||||
InitialDirectory = AppDomain.CurrentDomain.BaseDirectory,
|
||||
Filter = "Executables (*.exe)|*.exe",
|
||||
FilterIndex = 0,
|
||||
RestoreDirectory = true,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -225,10 +220,7 @@ namespace MPF.GUI.ViewModels
|
||||
/// </summary>
|
||||
/// <param name="name">Setting name to find</param>
|
||||
/// <returns>TextBox for that setting</returns>
|
||||
private TextBox TextBoxForPathSetting(string name)
|
||||
{
|
||||
return Parent.FindName(name + "TextBox") as TextBox;
|
||||
}
|
||||
private TextBox TextBoxForPathSetting(string name) => Parent.FindName(name + "TextBox") as TextBox;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -71,6 +71,11 @@
|
||||
IsChecked="{Binding Options.EnableDarkMode}"
|
||||
ToolTip="(Experimental) Enable dark mode across the entire application" Margin="0,4"
|
||||
/>
|
||||
|
||||
<CheckBox VerticalAlignment="Center" Content="Check for Updates on Startup"
|
||||
IsChecked="{Binding Options.CheckForUpdatesOnStartup}"
|
||||
ToolTip="Check for updates when the application starts" Margin="0,4"
|
||||
/>
|
||||
</UniformGrid>
|
||||
</TabItem>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user