完善功能
This commit is contained in:
57
电子展板/Base/DelegateCommand.cs
Normal file
57
电子展板/Base/DelegateCommand.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace 电子展板.Base
|
||||
{
|
||||
public class DelegateCommand : ICommand
|
||||
{
|
||||
public Action<object> ExecuteCommand = null;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public DelegateCommand(DelegateCommand focusAdjustToCommand)
|
||||
{
|
||||
}
|
||||
|
||||
public DelegateCommand(Action<object> Command)
|
||||
{
|
||||
ExecuteCommand = Command;
|
||||
}
|
||||
|
||||
public bool CanExecute(object paramter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Execute(object paramter)
|
||||
{
|
||||
ExecuteCommand?.Invoke(paramter);
|
||||
}
|
||||
}
|
||||
|
||||
public class DelegateCommand<T> : ICommand
|
||||
{
|
||||
public Action<T> ExecuteCommand = null;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public DelegateCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public DelegateCommand(Action<T> Command)
|
||||
{
|
||||
ExecuteCommand = Command;
|
||||
}
|
||||
|
||||
public bool CanExecute(object paramter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Execute(object paramter)
|
||||
{
|
||||
ExecuteCommand?.Invoke((T)paramter);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user