protected override void RemoveItem(int index) { bool isInTransaction = Transaction.Value > 0; if (!isInTransaction) { Transaction.Value += 1; } // OPTIMIZATION if (!DocUtils.IsInDocumentTree(this) && Hook == DocUtils.PerformActions) { ForceRemoveItem(index); } else { DocUtils.CommandTransaction( this, this.GetHashCode(), new DocListCommand(NotifyCollectionChangedAction.Remove, this[index], index)); } if (!isInTransaction) { Transaction.Value -= 1; } }
protected override void ClearItems() { if (Count == 0) { return; } bool isInTransaction = Transaction.Value > 0; if (!isInTransaction) { Transaction.Value += 1; } // OPTIMIZATION if (!DocUtils.IsInDocumentTree(this) && Hook == DocUtils.PerformActions) { foreach (var item in this.ToArray <T>()) { ForceRemoveItem(IndexOf(item)); } } else { DocUtils.CommandTransaction( this, this.GetHashCode(), new DocListCommand(NotifyCollectionChangedAction.Remove, this.ToArray <T>())); } if (!isInTransaction) { Transaction.Value -= 1; } }
public void CreateAction(T value) { DocUtils.CommandTransaction( this, CurrentTransactionId, new DocObjCommand(Value, value)); }