Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ActionStackViewModel"/>.
        /// </summary>
        /// <param name="serviceProvider">The service provider related to this view model</param>
        /// <param name="actionStack">The action stack. Cannot be null.</param>
        public ActionStackViewModel(IViewModelServiceProvider serviceProvider, ITransactionalActionStack actionStack)
            : base(serviceProvider)
        {
            ActionStack = actionStack;

            actionStack.ActionItemsAdded += ActionItemsAdded;
            actionStack.ActionItemsCleared += ActionItemsCleared;
            actionStack.ActionItemsDiscarded += ActionItemsDiscarded;
            actionStack.Undone += ActionItemModified;
            actionStack.Redone += ActionItemModified;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ActionStackViewModel"/>.
        /// </summary>
        /// <param name="serviceProvider">The service provider related to this view model</param>
        /// <param name="actionStack">The action stack. Cannot be null.</param>
        public ActionStackViewModel(IViewModelServiceProvider serviceProvider, ITransactionalActionStack actionStack)
            : base(serviceProvider)
        {
            ActionStack = actionStack;

            actionStack.ActionItemsAdded     += ActionItemsAdded;
            actionStack.ActionItemsCleared   += ActionItemsCleared;
            actionStack.ActionItemsDiscarded += ActionItemsDiscarded;
            actionStack.Undone += ActionItemModified;
            actionStack.Redone += ActionItemModified;
        }
Exemplo n.º 3
0
 public CombinedNodeCommandWrapper(IViewModelServiceProvider serviceProvider, string name, string observableNodePath, ObservableViewModelIdentifier identifier, IEnumerable <ModelNodeCommandWrapper> commands)
     : base(serviceProvider, null)
 {
     if (commands == null)
     {
         throw new ArgumentNullException("commands");
     }
     service            = serviceProvider.Get <ObservableViewModelService>();
     this.commands      = commands;
     this.name          = name;
     this.identifier    = identifier;
     actionStack        = serviceProvider.Get <ITransactionalActionStack>();
     ObservableNodePath = observableNodePath;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnonymousCommandWrapper"/> class.
 /// </summary>
 /// <param name="serviceProvider">A service provider that can provide a <see cref="ITransactionalActionStack"/> to use for this view model.</param>
 /// <param name="name">The name of this command.</param>
 /// <param name="combineMode">The combine mode to apply to this command.</param>
 /// <param name="redo">The do/redo function.</param>
 /// <param name="undo">The undo action.</param>
 /// <param name="dirtiables">The <see cref="IDirtiableViewModel"/> instances associated to this command.</param>
 public AnonymousCommandWrapper(IViewModelServiceProvider serviceProvider, string name, CombineMode combineMode, Func <object, UndoToken> redo, Action <object, UndoToken> undo, IEnumerable <IDirtiableViewModel> dirtiables)
     : base(serviceProvider, dirtiables)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (redo == null)
     {
         throw new ArgumentNullException("redo");
     }
     if (undo == null)
     {
         throw new ArgumentNullException("undo");
     }
     this.name        = name;
     this.combineMode = combineMode;
     this.redo        = redo;
     this.undo        = undo;
     actionStack      = serviceProvider.Get <ITransactionalActionStack>();
 }