Files
PowerToys/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/EmptyRecycleBinConfirmation.cs
Yu Leng f2a5505601 [cmdpal] Add fallback item for system command. (#38865)
* init

* Remove unused cache

* merge main

---------

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
2025-04-21 14:07:43 +08:00

38 lines
1.3 KiB
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CmdPal.Ext.System.Helpers;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.System;
public sealed partial class EmptyRecycleBinConfirmation : InvokableCommand
{
public EmptyRecycleBinConfirmation(bool settingEmptyRBSuccesMsg)
{
Name = Resources.Microsoft_plugin_command_name_empty;
_settingEmptyRBSuccesMsg = settingEmptyRBSuccesMsg;
}
public override CommandResult Invoke()
{
if (ResultHelper.ExecutingEmptyRecycleBinTask)
{
return CommandResult.ShowToast(new ToastArgs() { Message = Resources.Microsoft_plugin_sys_RecycleBin_EmptyTaskRunning });
}
var confirmArgs = new ConfirmationArgs()
{
Title = Resources.Microsoft_plugin_sys_confirmation,
Description = Resources.EmptyRecycleBin_ConfirmationDialog_Description,
PrimaryCommand = new EmptyRecycleBinCommand(_settingEmptyRBSuccesMsg),
IsPrimaryCommandCritical = true,
};
return CommandResult.Confirm(confirmArgs);
}
private bool _settingEmptyRBSuccesMsg;
}