コード例 #1
0
ファイル: UndoService.cs プロジェクト: iodes/WPFDesign
        /// <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);
            }
コード例 #3
0
            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);
		}
コード例 #5
0
        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;
			}
コード例 #10
0
 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);
 }
コード例 #13
0
 /// <summary>
 /// Registers the item.
 /// </summary>
 /// <param name="item">The item.</param>
 public void RegisterItem(ITransactionItem item)
 {
     m_Items.Add(item);
 }
コード例 #14
0
ファイル: UndoService.cs プロジェクト: fanyjie/SharpDevelop
		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
ファイル: UndoService.cs プロジェクト: fanyjie/SharpDevelop
		bool ITransactionItem.MergeWith(ITransactionItem other)
		{
			return false;
		}
コード例 #16
0
 public void Execute(ITransactionItem transaction)
 {
     throw new NotImplementedException();
 }