Show message box with button instead

This commit is contained in:
Jack251970 2025-07-14 16:31:09 +08:00
parent b5baf3ebea
commit 69d5e33150
2 changed files with 15 additions and 11 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
@ -327,17 +328,20 @@ public static class PluginInstaller
return;
}
if (API.ShowMsgBox(
string.Format(API.GetTranslation("updateAllPluginsSubtitle"),
Environment.NewLine, string.Join(", ", resultsForUpdate.Select(x => x.PluginExistingMetadata.Name))),
// Show message box with button to update all plugins
API.ShowMsgWithButton(
API.GetTranslation("updateAllPluginsTitle"),
MessageBoxButton.YesNo) == MessageBoxResult.No)
{
return;
}
API.GetTranslation("updateAllPluginsButtonContent"),
() =>
{
UpdateAllPlugins(resultsForUpdate);
},
string.Join(", ", resultsForUpdate.Select(x => x.PluginExistingMetadata.Name)));
}
// Update all plugins
await Task.WhenAll(resultsForUpdate.Select(async plugin =>
private static void UpdateAllPlugins(IEnumerable<dynamic> resultsForUpdate)
{
_ = Task.WhenAll(resultsForUpdate.Select(async plugin =>
{
var downloadToFilePath = Path.Combine(Path.GetTempPath(), $"{plugin.Name}-{plugin.NewVersion}.zip");

View file

@ -235,8 +235,8 @@
<system:String x:Key="installLocalPluginTooltip">Install plugin from local path</system:String>
<system:String x:Key="updateNoResultTitle">No update available</system:String>
<system:String x:Key="updateNoResultSubtitle">All plugins are up to date</system:String>
<system:String x:Key="updateAllPluginsTitle">Update all plugins</system:String>
<system:String x:Key="updateAllPluginsSubtitle">Would you like to update these plugins?{0}{0}{1}</system:String>
<system:String x:Key="updateAllPluginsTitle">Plugin updates available</system:String>
<system:String x:Key="updateAllPluginsButtonContent">Update all plugins</system:String>
<system:String x:Key="checkPluginUpdatesTooltip">Check plugin updates</system:String>
<!-- Setting Theme -->