mirror of
https://github.com/ShrlAlgo/AddinManager.git
synced 2026-03-08 00:48:56 +00:00
添加项目文件。
This commit is contained in:
32
AddInManager/RelayCommand.cs
Normal file
32
AddInManager/RelayCommand.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AddInManager
|
||||
{
|
||||
internal class RelayCommand : ICommand
|
||||
{
|
||||
private Action<object> execute;
|
||||
private Func<object, bool> canExecute;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
|
||||
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
|
||||
{
|
||||
if (execute == null)
|
||||
throw new System.ArgumentNullException();
|
||||
this.execute = execute;
|
||||
this.canExecute = canExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return canExecute == null || canExecute(parameter);
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
execute(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user