Line | |
---|
1 |
|
---|
2 | namespace Netron.Diagramming.Core {
|
---|
3 | /// <summary>
|
---|
4 | /// Implementation of ICommand for multiple actions
|
---|
5 | /// </summary>
|
---|
6 | class CompoundCommand : Command, ICompoundCommand {
|
---|
7 | #region Fields
|
---|
8 | private CollectionBase<ICommand> commands;
|
---|
9 | #endregion
|
---|
10 |
|
---|
11 | #region Properties
|
---|
12 | /// <summary>
|
---|
13 | /// Gets or sets the commands in this compound action.
|
---|
14 | /// </summary>
|
---|
15 | /// <value>The commands.</value>
|
---|
16 | public CollectionBase<ICommand> Commands {
|
---|
17 | get {
|
---|
18 | return commands;
|
---|
19 | }
|
---|
20 | set {
|
---|
21 | commands = value;
|
---|
22 | }
|
---|
23 | }
|
---|
24 |
|
---|
25 | #endregion
|
---|
26 |
|
---|
27 | #region Constructor
|
---|
28 | ///<summary>
|
---|
29 | ///Default constructor
|
---|
30 | ///</summary>
|
---|
31 | public CompoundCommand(IController controller)
|
---|
32 | : base(controller) {
|
---|
33 | commands = new CollectionBase<ICommand>();
|
---|
34 | }
|
---|
35 | #endregion
|
---|
36 |
|
---|
37 | #region Methods
|
---|
38 | /// <summary>
|
---|
39 | /// Perform redo of this command.
|
---|
40 | /// </summary>
|
---|
41 | public override void Redo() {
|
---|
42 | foreach (ICommand cmd in commands) {
|
---|
43 | cmd.Redo();
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 | /// <summary>
|
---|
48 | /// Perform undo of this command.
|
---|
49 | /// </summary>
|
---|
50 | public override void Undo() {
|
---|
51 | foreach (ICommand cmd in commands) {
|
---|
52 | cmd.Undo();
|
---|
53 | }
|
---|
54 | }
|
---|
55 | #endregion
|
---|
56 |
|
---|
57 | }
|
---|
58 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.