Beispiel #1
0
 public void Undo(DataGridView dataGridView, DataTable dataTable)
 {
     for (int thingIdx = ThingsList.Count - 1; thingIdx >= 0; thingIdx--)
     {
         IUndoRedo thing = ThingsList[thingIdx];
         thing.Undo(dataGridView, dataTable);
     }
 }
Beispiel #2
0
 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!");
     }
 }
Beispiel #3
0
        public void Undo()
        {
            if (!CanUndo())
            {
                return;
            }
            IUndoRedo action = undoStack.Pop();

            action.Undo();
            redoStack.Push(action);
            NotifyPropertyChanged("UndoDescription");
            NotifyPropertyChanged("RedoDescription");
            UndoOrRedoCalled?.Invoke(this, new EventArgs());
        }
Beispiel #4
0
        /// <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);
        }
Beispiel #5
0
        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");
            }
        }
Beispiel #7
0
    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);
            }
        }
    }