public void Undo(DataGridView dataGridView, DataTable dataTable) { for (int thingIdx = ThingsList.Count - 1; thingIdx >= 0; thingIdx--) { IUndoRedo thing = ThingsList[thingIdx]; thing.Undo(dataGridView, dataTable); } }
public void Undo() { if (this.oUndoRedoHandler is IUndoRedo) { IUndoRedo iur = (IUndoRedo)this.oUndoRedoHandler; iur.Undo(this.o, this.ura, this.oData); } else { throw new InterfaceNotImplementedException("IUndoRedo in " + this.oUndoRedoHandler.GetType().ToString() + " not implemented!"); } }
public void Undo() { if (!CanUndo()) { return; } IUndoRedo action = undoStack.Pop(); action.Undo(); redoStack.Push(action); NotifyPropertyChanged("UndoDescription"); NotifyPropertyChanged("RedoDescription"); UndoOrRedoCalled?.Invoke(this, new EventArgs()); }
/// <summary> /// Undo the last action, if any. /// </summary> public bool Undo() { if (_undoStack.Count == 0) { return(false); } IUndoRedo action = _undoStack.Pop(); action.Undo(); _redoStack.Push(action); return(true); }
void IUndoRedo.Undo() { if (_relatedAdds != null) { //Since a bulk add can include connectors between added views, we have to register those before an undo (removal) so they can be reestablished on a redo. if (_relatedActions == null) { _relatedActions = new List <ActionView>(); } else { _relatedActions.Clear(); } //First get connector actions for the whole operation foreach (var a in _relatedAdds) { var aso = a as AddSelectorOperation; if (aso == null) { continue; } foreach (var q in aso.target.qualifierViews) { if (q.actionView is IConnectorActionView) { _relatedActions.Add(q.actionView); } } } //Undo related if (_rootChange != null) { _rootChange.Undo(); } foreach (var a in _relatedAdds) { a.Undo(); } } DoUndo(); }
public void Undo() { if (UndoList.Count > 0) { IUndoRedo item = UndoList.First(); UndoList.RemoveFirst(); LinkedList <IUndoRedo> cpyRedo = new LinkedList <IUndoRedo>(RedoList.ToList()); cpyRedo.AddFirst(item); LinkedList <IUndoRedo> cpyUndo = new LinkedList <IUndoRedo>(UndoList.ToList()); item.Undo(); RedoList = new LinkedList <IUndoRedo>(cpyRedo); UndoList = new LinkedList <IUndoRedo>(cpyUndo); RaisePropertyChanged("RedoDescription"); RaisePropertyChanged("UndoDescription"); } }
public void Undo() { if (CanUndo()) { try { m_CsvForm.BeforeChangeCellValue(); IUndoRedo iur = m_UndoStack.Pop(); iur.Undo(m_CsvForm.GetDataGridView(), m_CsvForm.GetDataTable()); m_RedoStack.Push(iur); DoSomething(this, new DoSomethingEventArgs(DoEventType.Undo, iur.GetDoType())); m_CsvForm.AfterChangeCellValue(); MainForm.Instance.UpdateCellEdit(); } catch (System.Exception ex) { DebugUtility.ShowExceptionMessageBox("撤销失败", ex); } } }