mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[Settings] 'Check for updates' button behavior changed (#4385)
This commit is contained in:
@@ -50,6 +50,12 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
|
||||
System.Windows.Application.Current.Shutdown(); // close application
|
||||
});
|
||||
|
||||
// send IPC Message
|
||||
shellPage.SetCheckForUpdatesMessageCallback(msg =>
|
||||
{
|
||||
Program.GetTwoWayIPCManager().Send(msg);
|
||||
});
|
||||
|
||||
shellPage.SetElevationStatus(Program.IsElevated);
|
||||
shellPage.SetIsUserAnAdmin(Program.IsUserAnAdmin);
|
||||
shellPage.Refresh();
|
||||
|
||||
@@ -352,7 +352,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
// callback function to launch the URL to check for updates.
|
||||
private async void CheckForUpdates_Click()
|
||||
{
|
||||
await Launcher.LaunchUriAsync(new Uri("https://github.com/microsoft/PowerToys/releases"));
|
||||
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
settings.CustomActionName = "check_for_updates";
|
||||
|
||||
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings);
|
||||
GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings);
|
||||
|
||||
if (ShellPage.CheckForUpdatesMsgCallback != null)
|
||||
{
|
||||
ShellPage.CheckForUpdatesMsgCallback(customaction.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void Restart_Elevated()
|
||||
|
||||
@@ -33,6 +33,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
/// </summary>
|
||||
public static IPCMessageCallback SndRestartAsAdminMsgCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets iPC callback function for checking updates.
|
||||
/// </summary>
|
||||
public static IPCMessageCallback CheckForUpdatesMsgCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets view model.
|
||||
/// </summary>
|
||||
@@ -74,6 +79,15 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
SndRestartAsAdminMsgCallback = implementation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set check for updates IPC callback function.
|
||||
/// </summary>
|
||||
/// <param name="implementation">delegate function implementation.</param>
|
||||
public void SetCheckForUpdatesMessageCallback(IPCMessageCallback implementation)
|
||||
{
|
||||
CheckForUpdatesMsgCallback = implementation;
|
||||
}
|
||||
|
||||
public void SetElevationStatus(bool isElevated)
|
||||
{
|
||||
IsElevated = isElevated;
|
||||
|
||||
Reference in New Issue
Block a user