Files
2024-09-02 10:03:23 +07:00

43 lines
943 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace VirtualKeyboard.Wpf
{
class Command : ICommand
{
public event EventHandler CanExecuteChanged;
private bool _canExecuteCommand = true;
public bool CanExecuteCommand
{
get => _canExecuteCommand;
set
{
_canExecuteCommand = value;
CanExecuteChanged?.Invoke(this, new EventArgs());
}
}
private readonly Action<object> _execute;
public Command(Action<object> execute)
{
_execute = execute;
}
public bool CanExecute(object parameter)
{
return CanExecuteCommand;
}
public void Execute(object parameter)
{
_execute?.Invoke(parameter);
}
}
}