mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
[Settings] Update version in General Settings (#2601)
* Update version in General Settings * Set version in settings.json file * Only overwrite the settings.json file if it is newer than the old version. * Fix tests * Fix test names and added comment
This commit is contained in:
committed by
GitHub
parent
d401474981
commit
7fc140af01
@@ -10,6 +10,8 @@ using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels.Commands;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib.Utilities;
|
||||
using Windows.Data.Html;
|
||||
using Windows.System;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.UI.Xaml;
|
||||
@@ -32,6 +34,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
try
|
||||
{
|
||||
GeneralSettingsConfigs = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
|
||||
if (Helper.CompareVersions(GeneralSettingsConfigs.PowertoysVersion, Helper.GetProductVersion()) < 0)
|
||||
{
|
||||
// Update settings
|
||||
GeneralSettingsConfigs.PowertoysVersion = Helper.GetProductVersion();
|
||||
SettingsUtils.SaveSettings(GeneralSettingsConfigs.ToJsonString(), string.Empty);
|
||||
}
|
||||
}
|
||||
catch (FormatException e)
|
||||
{
|
||||
// If there is an issue with the version number format, don't migrate settings.
|
||||
Debug.WriteLine(e.Message);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -216,6 +230,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public string PowerToysVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return Helper.GetProductVersion();
|
||||
}
|
||||
}
|
||||
|
||||
public void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
// Notify UI of property change
|
||||
|
||||
Reference in New Issue
Block a user