using System.Windows;
using XFEToolBox.Client.Model;
using XFEToolBox.Client.Utilities;
namespace XFEToolBox.Tools.QuickSuite;
// This adapter and the namespaced implementation are included in the .xfetool.
// Only the host's stable theme and confirmation APIs are used, never its old page.
public static class PackagedQuickTools
{
private static bool configured;
public static QuickToolPage Create(string kind)
{
if (!Enum.TryParse<QuickToolKind>(kind, out var tool)) throw new ArgumentException("未知工具。");
if (!configured)
{
configured = true;
QuickToolPage.Confirmation = (title, message, owner) => PopupHelper.ShowConfirmDialog(message,
new PopupWindowOptions { Title = title, Owner = owner, Width = 560, Height = 360 }, true, "确认执行") == MessageBoxResult.OK;
Application.Current.Exit += (_, _) => { ClipboardHistory.Shared.Dispose(); AwakeLease.Shared.Dispose(); };
}
return new QuickToolPage(tool);
}
}
using System.Windows;
using XFEToolBox.Client.Model;
using XFEToolBox.Client.Utilities;
namespace XFEToolBox.Tools.QuickSuite;
// This adapter and the namespaced implementation are included in the .xfetool.
// Only the host's stable theme and confirmation APIs are used, never its old page.
public static class PackagedQuickTools
{
private static bool configured;
public static QuickToolPage Create(string kind)
{
if (!Enum.TryParse<QuickToolKind>(kind, out var tool)) throw new ArgumentException("未知工具。");
if (!configured)
{
configured = true;
QuickToolPage.Confirmation = (title, message, owner) => PopupHelper.ShowConfirmDialog(message,
new PopupWindowOptions { Title = title, Owner = owner, Width = 560, Height = 360 }, true, "确认执行") == MessageBoxResult.OK;
Application.Current.Exit += (_, _) => { ClipboardHistory.Shared.Dispose(); AwakeLease.Shared.Dispose(); };
}
return new QuickToolPage(tool);
}
}