private void TransactionDiscarded(object sender, TransactionsDiscardedEventArgs e) { Dispatcher.InvokeAsync(() => { foreach (var transaction in e.Transactions) { Transactions.RemoveWhere(x => x.Operation == transaction); } }).Forget(); }
private void TransactionDiscarded(object sender, [NotNull] TransactionsDiscardedEventArgs e) { var dirtiables = new HashSet <IDirtiable>(); foreach (var dirtyingOperation in e.Transactions.SelectMany(x => x.Operations).SelectMany(GetDirtyingOperations)) { allOperations.Remove(dirtyingOperation); foreach (var dirtiable in dirtyingOperation.Dirtiables) { // Unregister this operation from its dirtiable var dirtyingOperations = TryGetOperationsMap(dirtyingOperationsMap, dirtiable); dirtyingOperations?.Remove(dirtyingOperation); if (e.Reason == DiscardReason.StackFull) { // And register it back as a frozen operation if it is still affecting the dirtiable dirtyingOperations = GetOrCreateOperationsMap(frozenOperationsMap, dirtiable); dirtyingOperations.Add(dirtyingOperation); } } } // Then update affected dirtiables UpdateDirtiables(dirtiables); }
private void TransactionDiscarded(object sender, TransactionsDiscardedEventArgs e) { Dispatcher.Invoke(() => transactions.RemoveWhere(x => e.Transactions.Any(y => x.Id == y.Id))); }