This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ActionCommand : ICommand | |
{ | |
private readonly Action<object> _invokedAction; | |
public ActionCommand(Action invokedAction) | |
{ | |
_invokedAction = _ => invokedAction?.Invoke(); | |
} | |
public ActionCommand(Action<object> invokedAction) | |
{ | |
_invokedAction = invokedAction; | |
} | |
public bool CanExecute(object parameter) => true; | |
public void Execute(object parameter) => _invokedAction?.Invoke(parameter); | |
public event EventHandler CanExecuteChanged; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment