namespace Netron.Diagramming.Core {
///
/// Implementation of ICommand for multiple actions
///
class CompoundCommand : Command, ICompoundCommand {
#region Fields
private CollectionBase commands;
#endregion
#region Properties
///
/// Gets or sets the commands in this compound action.
///
/// The commands.
public CollectionBase Commands {
get {
return commands;
}
set {
commands = value;
}
}
#endregion
#region Constructor
///
///Default constructor
///
public CompoundCommand(IController controller)
: base(controller) {
commands = new CollectionBase();
}
#endregion
#region Methods
///
/// Perform redo of this command.
///
public override void Redo() {
foreach (ICommand cmd in commands) {
cmd.Redo();
}
}
///
/// Perform undo of this command.
///
public override void Undo() {
foreach (ICommand cmd in commands) {
cmd.Undo();
}
}
#endregion
}
}