public void Redo(int index) { if (s_current.Child.Count > 0) { ICommand run = s_current.Child[index]; ICommand rev = VsqFile.executeCommand(run); rev.Parent = s_current; for (int i = 0; i < run.Child.Count; i++) { run.Child[i].Parent = rev; rev.Child.Add(run.Child[i]); } s_current.Child[index] = rev; s_current = run; } }
public void Undo() { ICommand run = s_current; ICommand rev = VsqFile.executeCommand(run); for (int i = 0; i < s_current.Child.Count; i++) { s_current.Child[i].Parent = rev; rev.Child.Add(s_current.Child[i]); } rev.Parent = s_current.Parent; for (int i = 0; i < s_current.Parent.Child.Count; i++) { if (Object.ReferenceEquals(s_current, s_current.Parent.Child[i])) { s_current.Parent.Child[i] = rev; break; } } s_current = s_current.Parent; }