private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (stack.RollInProgress) { return; } // We create a transaction at the first change, and complete it at the next dispatcher frame with InvokeAsync if (currentTransaction == null) { currentTransaction = stack.CreateTransaction(); dispatcher.InvokeAsync(CompleteTransaction); } if (e.Action == NotifyCollectionChangedAction.Add) { PropertySelectionSuppressed = true; try { // When we add a new item to selection, we clear the selection in all other collections foreach (var scope in scopes.Where(x => !x.Collections.Contains(sender))) { foreach (var collection in scope.Collections) { var descriptor = TypeDescriptorFactory.Default.Find(collection.GetType()) as CollectionDescriptor; descriptor?.Clear(collection); } } } finally { PropertySelectionSuppressed = false; } } }
public ITransaction CreateTransaction() { var transaction = UndoRedoInProgress ? new DummyTransaction() : stack.CreateTransaction(); transaction.BeforeComplete += TryMergeOperations; return(transaction); }
public ITransaction CreateTransaction(TransactionFlags flags = TransactionFlags.None) { if (UndoRedoInProgress) { return(new DummyTransaction()); } transactionCompletion = new TaskCompletionSource <int>(); return(stack.CreateTransaction(flags)); }
public ITransaction CreateTransaction() { if (UndoRedoInProgress) { return(new DummyTransaction()); } else { transactionCompletion = new TaskCompletionSource <int>(); return(stack.CreateTransaction()); } }
public ITransaction CreateTransaction() { return(UndoRedoInProgress ? new DummyTransaction() : stack.CreateTransaction()); }