예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ActionHistoryViewModel"/> class.
 /// </summary>
 /// <param name="session">The session this view model belongs to.</param>
 public ActionHistoryViewModel(SessionViewModel session)
     : base(session.SafeArgument(nameof(session)).ServiceProvider)
 {
     this.session = session;
     service      = ServiceProvider.Get <IUndoRedoService>();
     Transactions.CollectionChanged += (sender, e) => RefreshUndoRedoStatus();
     UndoCommand = new AnonymousCommand(ServiceProvider, () => { service.Undo(); session.CheckConsistency(); RefreshUndoRedoStatus(); });
     RedoCommand = new AnonymousCommand(ServiceProvider, () => { service.Redo(); session.CheckConsistency(); RefreshUndoRedoStatus(); });
     RefreshUndoRedoStatus();
 }