67 lines
1020 B
C#
67 lines
1020 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace CPF.ReoGrid.Common
|
|
{
|
|
public class ActionGroup : IUndoableAction, IAction
|
|
{
|
|
public List<IAction> Actions
|
|
{
|
|
get
|
|
{
|
|
return this.actions;
|
|
}
|
|
set
|
|
{
|
|
this.actions = value;
|
|
}
|
|
}
|
|
|
|
public ActionGroup(string name, List<IAction> actions)
|
|
{
|
|
this.name = name;
|
|
this.actions = actions;
|
|
}
|
|
|
|
public ActionGroup(string name)
|
|
{
|
|
this.actions = new List<IAction>();
|
|
}
|
|
|
|
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<object>());
|
|
}
|
|
|
|
private List<IAction> actions;
|
|
|
|
private string name;
|
|
}
|
|
}
|