20211124_ZNZT_upperpc/MonitoringTechnology/Common/CommandBase1.cs
2023-02-03 08:31:48 +08:00

34 lines
776 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace MonitoringTechnology.Common
{
public class CommandBase1 : ICommand
{
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return DoCanExcute?.Invoke(parameter) == true;
}
public void Execute(object parameter)
{
DoExcute?.Invoke(parameter);
}
public Action<object> DoExcute { set; get; }
public Func<object, bool> DoCanExcute { set; get; }
public void RaiseCanExecuteChanged()
{
CanExecuteChanged?.Invoke(this, new EventArgs());
}
}
}