예제 #1
0
        /// <summary>
        /// Redoes a previously undone action.
        /// </summary>
        public void Redo()
        {
            if (!CanRedo)
            {
                throw new InvalidOperationException("Cannot Redo: redo stack is empty");
            }
            if (_transactionStack.Count != 0)
            {
                throw new InvalidOperationException("Cannot Redo while transaction is running");
            }
            ITransactionItem item = _redoStack.Pop();

            try
            {
                item.Do();
                _undoStack.Push(item);
                OnUndoStackChanged(EventArgs.Empty);
            }
            catch
            {
                // state might be invalid now, clear stacks to prevent getting more inconsistencies
                Clear();
                throw;
            }
        }
예제 #2
0
            public bool MergeWith(ITransactionItem other)
            {
                SetNameAction o = other as SetNameAction;

                if (o != null && designItem == o.designItem)
                {
                    newName = o.newName;
                    return(true);
                }
                return(false);
            }
            public bool MergeWith(ITransactionItem other)
            {
                PropertyChangeAction o = other as PropertyChangeAction;

                if (o != null && property._property == o.property._property)
                {
                    newIsSet = o.newIsSet;
                    newValue = o.newValue;
                    return(true);
                }
                return(false);
            }
예제 #4
0
		public void Execute(ITransactionItem item)
		{
			AssertState(TransactionState.Open);
			item.Do();
			
			foreach (var existingItem in items) {
				if (existingItem.MergeWith(item))
					return;
			}
			
			items.Add(item);
		}
        void Execute(ITransactionItem item)
        {
            UndoService undoService = context.Services.GetService <UndoService>();

            if (undoService != null)
            {
                undoService.Execute(item);
            }
            else
            {
                item.Do();
            }
        }
예제 #6
0
 internal void Execute(ITransactionItem item)
 {
     if (_transactionStack.Count == 0)
     {
         item.Do();
         _undoStack.Push(item);
         _redoStack.Clear();
         OnUndoStackChanged(EventArgs.Empty);
     }
     else
     {
         _transactionStack.Peek().Execute(item);
     }
 }
예제 #7
0
            public PropertyChangeAction(XamlModelProperty property, XamlPropertyValue newValue, bool newIsSet)
            {
                this.property = property;
                this.newValue = newValue;
                this.newIsSet = newIsSet;

                oldIsSet = property._property.IsSet;
                oldValue = property._property.PropertyValue;

                if (oldIsSet && oldValue == null && property.IsCollection)
                {
                    collectionTransactionItem = property._collectionElements.CreateResetTransaction();
                }
            }
예제 #8
0
        public void Execute(ITransactionItem item)
        {
            AssertState(TransactionState.Open);
            item.Do();

            foreach (var existingItem in items)
            {
                if (existingItem.MergeWith(item))
                {
                    return;
                }
            }

            items.Add(item);
        }
예제 #9
0
			public bool MergeWith(ITransactionItem other)
			{
				SetNameAction o = other as SetNameAction;
				if (o != null && designItem == o.designItem) {
					newName = o.newName;
					return true;
				}
				return false;
			}
 public bool MergeWith(ITransactionItem other)
 {
     return(false);
 }
예제 #11
0
 /// <summary>
 /// Registers the item.
 /// </summary>
 /// <param name="item">The item.</param>
 public void RegisterItem(ITransactionItem item)
 {
     m_Items.Add(item);
 }
예제 #12
0
 bool ITransactionItem.MergeWith(ITransactionItem other)
 {
     return(false);
 }
 /// <summary>
 /// Registers the item.
 /// </summary>
 /// <param name="item">The item.</param>
 public void RegisterItem(ITransactionItem item)
 {
     m_Items.Add(item);
 }
예제 #14
0
		internal void Execute(ITransactionItem item)
		{
			if (_transactionStack.Count == 0) {
				item.Do();
				_undoStack.Push(item);
				_redoStack.Clear();
				OnUndoStackChanged(EventArgs.Empty);
			} else {
				_transactionStack.Peek().Execute(item);
			}
		}
예제 #15
0
		bool ITransactionItem.MergeWith(ITransactionItem other)
		{
			return false;
		}
예제 #16
0
 public void Execute(ITransactionItem transaction)
 {
     throw new NotImplementedException();
 }