Only execute commands from code if allowed

This commit is contained in:
tyrrrz
2026-04-02 14:36:06 +03:00
parent f6166764e9
commit d467948d0b
3 changed files with 19 additions and 4 deletions

View File

@@ -0,0 +1,15 @@
using System.Windows.Input;
namespace DiscordChatExporter.Gui.Utils.Extensions;
internal static class CommandExtensions
{
extension(ICommand command)
{
public void ExecuteIfCan(object? parameter = null)
{
if (command.CanExecute(parameter))
command.Execute(parameter);
}
}
}