mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
[Settings] Temporary string showing the latest available version (#6254)
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
using Windows.Data.Json;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
@@ -40,6 +42,34 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
ShellPage.SendRestartAdminIPCMessage,
|
||||
ShellPage.SendCheckForUpdatesIPCMessage);
|
||||
|
||||
ShellPage.ShellHandler.IPCResponseHandleList.Add((JsonObject json) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
string version = json.GetNamedString("version");
|
||||
bool isLatest = json.GetNamedBoolean("isVersionLatest");
|
||||
|
||||
var str = string.Empty;
|
||||
if (isLatest)
|
||||
{
|
||||
str = ResourceLoader.GetForCurrentView().GetString("GeneralSettings_VersionIsLatest");
|
||||
}
|
||||
else if (version != string.Empty)
|
||||
{
|
||||
str = ResourceLoader.GetForCurrentView().GetString("GeneralSettings_NewVersionIsAvailable");
|
||||
if (str != string.Empty)
|
||||
{
|
||||
str += ": " + version;
|
||||
}
|
||||
}
|
||||
|
||||
ViewModel.LatestAvailableVersion = string.Format(str);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
});
|
||||
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user