public void Add(UndoTask task) { for (int i = UndoTasks.Count - 1; i > Cursor; i--) { UndoTasks.RemoveAt(i); } UndoTasks.Add(task); Cursor = UndoTasks.Count - 1; }
public UndoPosition Undo() { var position = new UndoPosition(); UndoTask task = UndoTasks[Cursor]; if (task is UndoTaskClassifyMultiple) { position = DispatchUndoClassifyMultiple((UndoTaskClassifyMultiple)task); } else if (task is UndoTaskClassifyFirstCycleMultiple) { position = DispatchUndoClassifyFirstCycleMultiple((UndoTaskClassifyFirstCycleMultiple)task); } else if (task is UndoTaskHorizontalSplitMultiple) { position = DispatchUndoHorizontalSplitMultiple((UndoTaskHorizontalSplitMultiple)task); } else if (task is UndoTaskVerticalSplitMultiple) { position = DispatchUndoVerticalSplitMultiple((UndoTaskVerticalSplitMultiple)task); } else if (task is UndoTaskHorizontalMergeMultiple) { position = DispatchUndoHorizontalMergeMultiple((UndoTaskHorizontalMergeMultiple)task); } else if (task is UndoTaskVerticalMergeMultiple) { position = DispatchUndoVerticalMergeMultiple((UndoTaskVerticalMergeMultiple)task); } else if (task is UndoTaskApproveMultiple) { position = DispatchUndoApproveMultiple((UndoTaskApproveMultiple)task); } Cursor--; return(position); }