2016-02-18 11:30:36 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
|
|
2020-04-21 09:12:17 +00:00
|
|
|
|
namespace Flow.Launcher.ViewModel
|
2016-02-18 11:30:36 +00:00
|
|
|
|
{
|
|
|
|
|
|
public class RelayCommand : ICommand
|
|
|
|
|
|
{
|
2022-08-09 00:35:38 +00:00
|
|
|
|
private readonly Action<object> _action;
|
2016-02-18 11:30:36 +00:00
|
|
|
|
|
2016-02-12 06:21:12 +00:00
|
|
|
|
public RelayCommand(Action<object> action)
|
2016-02-18 11:30:36 +00:00
|
|
|
|
{
|
2016-02-21 15:42:37 +00:00
|
|
|
|
_action = action;
|
2016-02-18 11:30:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual bool CanExecute(object parameter)
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-09 00:35:38 +00:00
|
|
|
|
#pragma warning disable CS0067 // the event is never used
|
2016-02-18 11:30:36 +00:00
|
|
|
|
public event EventHandler CanExecuteChanged;
|
2022-08-09 00:35:38 +00:00
|
|
|
|
#pragma warning restore CS0067
|
2016-02-18 11:30:36 +00:00
|
|
|
|
|
|
|
|
|
|
public virtual void Execute(object parameter)
|
|
|
|
|
|
{
|
2016-02-22 21:47:10 +00:00
|
|
|
|
_action?.Invoke(parameter);
|
2016-02-18 11:30:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|