protected override async ValueTask <bool> TryInvokeAsync(ObservableCollectionItemsChangedArgs e) { if (consumer == null) { return(false); } if (!consumer.IsAlive()) { return(true); } if (e.ObservableCollection.ElementType == typeof(Task)) { foreach (var task in e.ItemsAdded.Cast <Task>()) { _ = task.ContinueWith(t => { consumer?.ForceUpdate(); }); } return(true); } if (e.NewCount != e.OldCount || e.ItemsAdded.Any() || e.ItemsRemoved.Any()) { await consumer.ForceUpdate(); return(true); } return(false); }
public void NotifyCollectionItemsChanged(ObservableCollectionItemsChangedArgs args) { foreach (var subscriber in subscribers) { InvokeActionOrRemove(subscriber.Key, subscriber => subscriber.CollectionItemsChangedAsync(args)); } }
private void OnCollectionItemsChanged(object sender, ObservableCollectionItemsChangedArgs e) { bool executed = transactionLock.TryExecuteWithWriteLock(() => { Subscribers.NotifyCollectionItemsChanged(e); }); if (!executed) { collectionChangedQueue.Enqueue(e); return; } DequeueAll(); }
protected override async ValueTask <bool> TryInvokeAsync(ObservableCollectionItemsChangedArgs e) { if (!consumer.IsAlive()) { return(true); } if (e.NewCount != e.OldCount || e.ItemsAdded.Any() || e.ItemsRemoved.Any()) { await consumer.ForceUpdate(); return(true); } return(false); }
protected async override ValueTask <bool> TryInvokeAsync(ObservableCollectionItemsChangedArgs e) { if (!initialized) { initialized = true; if (reactable.RequiresInitialInvoke()) { await InvokeInternalAsync(true); return(true); } } /*if (e.NewCount != e.OldCount || e.ItemsAdded.Any() || e.ItemsRemoved.Any()) * { * InvokeInternal(false); * return new ValueTask<bool>(true); * }*/ return(false); }
private void OnCollectionItemsChanged(object sender, ObservableCollectionItemsChangedArgs e) { Subscribers.NotifyCollectionItemsChanged(e); }