Flow.Launcher/Flow.Launcher/ViewModel/RelayCommand.cs

30 lines
649 B
C#
Raw Normal View History

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