public bool RunCommand(XTMFCommand command, ref string error) { lock (_SessionLock) { if (command.Do(ref error)) { HasChanged = true; if (_InCombinedContext) { var list = _CombinedCommands; list.Add(command); } else { if (command.CanUndo()) { _UndoStack.Add(command); } CommandExecuted?.Invoke(this, new EventArgs()); } // if we do something new, redo no long is available _RedoStack.Clear(); return(true); } return(false); } }
public bool RunCommand(XTMFCommand command, ref string error) { lock (SessionLock) { if (_IsRunning) { error = "You can not edit a model system while it is running."; return(false); } if (command.Do(ref error)) { HasChanged = true; if (command.CanUndo()) { UndoStack.Add(command); } // if we do something new, redo no long is available RedoStack.Clear(); return(true); } return(false); } }