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 _execute; public Command(Action execute) { _execute = execute; } public bool CanExecute(object parameter) { return CanExecuteCommand; } public void Execute(object parameter) { _execute?.Invoke(parameter); } } }