34 lines
509 B
C#
34 lines
509 B
C#
using System;
|
|
using System.Windows.Input;
|
|
|
|
namespace GUI.Model;
|
|
|
|
public class Command : ICommand
|
|
{
|
|
public Action Action { get; set; }
|
|
|
|
public Command(Action action)
|
|
{
|
|
Action = action;
|
|
}
|
|
|
|
#region Implementation of ICommand
|
|
|
|
/// <inheritdoc />
|
|
public bool CanExecute(object? parameter)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void Execute(object? parameter)
|
|
{
|
|
Action?.Invoke();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public event EventHandler? CanExecuteChanged;
|
|
|
|
#endregion
|
|
}
|