using System; using System.Collections.Generic; namespace CPF.ReoGrid.Common { public class ActionGroup : IUndoableAction, IAction { public List Actions { get { return this.actions; } set { this.actions = value; } } public ActionGroup(string name, List actions) { this.name = name; this.actions = actions; } public ActionGroup(string name) { this.actions = new List(); } public virtual void Do() { foreach (IAction action in this.actions) { action.Do(); } } public virtual void Undo() { for (int i = this.actions.Count - 1; i >= 0; i--) { ((IUndoableAction)this.actions[i]).Undo(); } } public virtual void Redo() { this.Do(); } public virtual string GetName() { return this.name; } public override string ToString() { return string.Format("ActionGroup[" + this.name + "]", Array.Empty()); } private List actions; private string name; } }