public void Do(IVBUndoManager undoManager) { //try { if (stateDo) { System.Diagnostics.Debug.WriteLine("Redoing the action."); Logger.Redo(); } else { System.Diagnostics.Debug.WriteLine("Undoing the action."); Logger.Undo(); } // Toggle the state flag. stateDo = !stateDo; // If this method receives a valid undoManager as a // parameter, re-add this instance to the Undo Manager. if (undoManager != null) { undoManager.Add(this); } } //catch (Exception err) //{ // System.Diagnostics.Debug.WriteLine(err.Message); //} }
public void Do(IVBUndoManager undoManager) { try { if (_done) { _undoAction(); } else { _doAction(); } _done = !_done; undoManager?.Add(this); } catch (Exception err) { System.Diagnostics.Debug.Write(err.ToString()); } }