首次上传

This commit is contained in:
hanqiangqiang
2026-06-15 10:56:30 +08:00
commit b0213b94d6
4160 changed files with 736101 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace SicUI.Controls.Common
{
public class RelayCommand : ICommand
{
private readonly Func<Object, Boolean> canExecute;
private readonly Action<Object> execute;
public RelayCommand(Action<Object> execute) : this(execute, null)
{
}
public RelayCommand(Action<Object> execute, Func<Object, Boolean> canExecute)
{
this.execute = execute ?? throw new ArgumentNullException("execute");
this.canExecute = canExecute;
}
public event EventHandler CanExecuteChanged
{
add
{
if (canExecute != null)
CommandManager.RequerySuggested += value;
}
remove
{
if (canExecute != null)
CommandManager.RequerySuggested -= value;
}
}
public Boolean CanExecute(Object parameter)
{
return canExecute == null ? true : canExecute(parameter);
}
public void Execute(Object parameter)
{
execute(parameter);
}
}
}