//Executes and stores command.
        public void ExecuteCommand(UndoableCommand command, object parameter, bool clearRedo = true)
        {
            try
            {
                command.Execute(parameter);

                _commands.Push(command);
                _commandParameters.Push(parameter);

                OnPropertyChanged(nameof(CanUndo));

                if (clearRedo)
                {
                    _redoCommands.Clear();
                    _redoCommandParameters.Clear();
                }
            }
            catch (CommandFailedException)
            {
            }
        }
Beispiel #2
0
 public UndoableCommandForView(ViewModel1 viewModel)
     : base(viewModel)
 {
     _command = CreateUndoableCommand();
 }