Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 |
|
---|
6 | namespace Microsoft.Research.DynamicDataDisplay.Common.UndoSystem
|
---|
7 | {
|
---|
8 | public sealed class LambdaUndoAction : UndoAction
|
---|
9 | {
|
---|
10 | private readonly Action doAction;
|
---|
11 | private readonly Action undoAction;
|
---|
12 |
|
---|
13 | public LambdaUndoAction(Action doAction, Action undoAction)
|
---|
14 | {
|
---|
15 | if (doAction == null)
|
---|
16 | throw new ArgumentNullException("doHander");
|
---|
17 | if (undoAction == null)
|
---|
18 | throw new ArgumentNullException("undoAction");
|
---|
19 |
|
---|
20 | this.doAction = doAction;
|
---|
21 | this.undoAction = undoAction;
|
---|
22 | }
|
---|
23 |
|
---|
24 | public override void Do()
|
---|
25 | {
|
---|
26 | doAction();
|
---|
27 | }
|
---|
28 |
|
---|
29 | public override void Undo()
|
---|
30 | {
|
---|
31 | undoAction();
|
---|
32 | }
|
---|
33 | }
|
---|
34 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.