36 lines
721 B
C#
36 lines
721 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Intromat.Interfaces;
|
|
using ReactiveUI;
|
|
|
|
namespace Intromat.ViewModels
|
|
{
|
|
public class UndoItemGroup : ReactiveObject, IUndoItem
|
|
{
|
|
public List<IUndoItem> Items = new();
|
|
|
|
public UndoItemGroup(IFile file)
|
|
{
|
|
File = file;
|
|
}
|
|
|
|
public IFile File { get; }
|
|
|
|
public void Redo()
|
|
{
|
|
foreach (var item in Items)
|
|
item.Redo();
|
|
}
|
|
|
|
public void Undo()
|
|
{
|
|
foreach (var item in Items.Reverse<IUndoItem>())
|
|
item.Undo();
|
|
}
|
|
|
|
public void Push(IUndoItem item)
|
|
{
|
|
Items.Add(item);
|
|
}
|
|
}
|
|
} |