JD2022-TU1/main/tools/modules/JD.Guinness.WPF.Module/PlumeAction/SaveAction.cs

22 lines
659 B
C#

using System.Windows.Input;
using JD.Guinness.WPF.Module.ViewModel;
using Plume.Icons;
using Plume.Interfaces.WPF.Actions;
namespace JD.Guinness.WPF.Module.PlumeAction
{
public sealed class SaveAction : Action
{
private readonly DelegateCommand<bool> _command;
public SaveAction(GameViewModel gameViewModel)
: base("Save", "Save", StandardIcon.Save, new KeyGesture(Key.S, ModifierKeys.Control))
{
_command = gameViewModel.SaveCommand;
}
public override bool CanExecute() => _command.CanExecute(false);
public override void TryExecute() => _command.Execute(false);
}
}