public IObservable <HistoryEntry> Record(HistoryEntry entry, Func <HistoryEntry, IObservable <HistoryEntry> > execute) { StackRedo.Clear(); UpdateSubjects(true); return(execute(entry).Do(updatedEntry => { StackUndo.Push(updatedEntry); UpdateSubjects(); })); }
public IObservable <HistoryEntry> Redo(Func <HistoryEntry, IObservable <HistoryEntry> > execute) { if (StackRedo.Count == 0) { throw new Exception(); } UpdateSubjects(true); return(execute(StackRedo.Pop()).Do(entry => { StackUndo.Push(entry); UpdateSubjects(); })); }