/// <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; } }
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); }
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(); } }
internal void Execute(ITransactionItem item) { if (_transactionStack.Count == 0) { item.Do(); _undoStack.Push(item); _redoStack.Clear(); OnUndoStackChanged(EventArgs.Empty); } else { _transactionStack.Peek().Execute(item); } }
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(); } }
public void Execute(ITransactionItem item) { AssertState(TransactionState.Open); item.Do(); foreach (var existingItem in items) { if (existingItem.MergeWith(item)) { return; } } items.Add(item); }
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); }
/// <summary> /// Registers the item. /// </summary> /// <param name="item">The item.</param> public void RegisterItem(ITransactionItem item) { m_Items.Add(item); }
bool ITransactionItem.MergeWith(ITransactionItem other) { return(false); }
bool ITransactionItem.MergeWith(ITransactionItem other) { return false; }
public void Execute(ITransactionItem transaction) { throw new NotImplementedException(); }