From 213b60459d1fc84febe53f0cef72c7638ea19834 Mon Sep 17 00:00:00 2001 From: Igor Buchelnikov Date: Wed, 31 Mar 2021 17:32:17 +0300 Subject: [PATCH] 2.1.0 nuget package --- .../OcDispatcherTests.cs | 1 + .../ObservableComputations.csproj | 16 +++++++--------- src/ObservableComputations/OcDispatcher.cs | 6 +++++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/ObservableComputations.Test/OcDispatcherTests.cs b/src/ObservableComputations.Test/OcDispatcherTests.cs index 2b2e9c5..de81d6b 100644 --- a/src/ObservableComputations.Test/OcDispatcherTests.cs +++ b/src/ObservableComputations.Test/OcDispatcherTests.cs @@ -288,6 +288,7 @@ public void TestSetThreadProperites() OcConfiguration.SaveInstantiationStackTrace = true; OcDispatcher dispatcher = new OcDispatcher(2); Assert.AreEqual(dispatcher.GetQueueCount(0), 0); + Assert.AreEqual(dispatcher.GetQueueCount(), 0); Assert.IsTrue(dispatcher.InstantiationStackTrace != null); ApartmentState apartmentState = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? ApartmentState.Unknown : ApartmentState.MTA; Assert.AreEqual(dispatcher.NewInvocationBehaviour, NewInvocationBehaviour.Accept); diff --git a/src/ObservableComputations/ObservableComputations.csproj b/src/ObservableComputations/ObservableComputations.csproj index f30c965..2baf0d9 100644 --- a/src/ObservableComputations/ObservableComputations.csproj +++ b/src/ObservableComputations/ObservableComputations.csproj @@ -10,7 +10,7 @@ true Igor Buchelnikov (igor_buchelnikov_github@mail.ru) Igor Buchelnikov (igor_buchelnikov_github@mail.ru) - Cross-platform .NET library for computations whose arguments and results are objects that implement INotifyPropertyChanged and INotifyCollectionChanged (ObservableCollection) interfaces. The computations include ones similar to LINQ, the computation of arbitrary expression and additional features. The computations are implemented as extension methods, like LINQ ones. You can combine calls of ObservableComputations extension methods including chaining and nesting, as you do for LINQ methods. Computations in background threads, including parallel ones, as well as time-related processing of CollectionChanged and PropertyChanged events, are supported. ObservableComputations is easy to use and powerful implementation of reactive programming paradigm. With ObservableComputations, your code will fit more to the functional style than with standard LINQ. + Cross-platform .NET library for computations whose arguments and results are objects that implement INotifyPropertyChanged and INotifyCollectionChanged (ObservableCollection) interfaces. The computations include ones similar to LINQ, the computation of arbitrary expression, and additional features. The computations are implemented as extension methods, like LINQ ones. You can combine calls of ObservableComputations extension methods including chaining and nesting, as you do for LINQ methods. Computations in background threads, including parallel ones, as well as time-related processing of CollectionChanged and PropertyChanged events, are supported. ObservableComputations is easy to use and powerful implementation of reactive programming paradigm. With ObservableComputations, your code will fit more to the functional style than with standard LINQ. https://github.com/IgorBuchelnikov/ObservableComputations/blob/master/LICENSE https://github.com/IgorBuchelnikov/ObservableComputations https://github.com/IgorBuchelnikov/ObservableComputations.git @@ -19,28 +19,26 @@ en true false - * New feaures -OcDispatcher async delegates with await -OcDispatcher InvocationResult IReadScalar -OcDispatcher InvocationResult Invocation -OcDispatcher Status Property - + * New features +"async" and "await" keywords support in OcDispatcher +OcDispatcher's InvocationResult now implements IReadScalar * Fixed: — CollectionPausing — ScalarPausing — CollectionDispatching — OcDispatcher +— other bug fixes * Renamed InvocationResult.Result -> InvocationResult.Value -DebugInfo.ExecutingOcDispatcherInvocations -> StaticInfo.ExecutingOcDispatcherInvocationStacks +DebugInfo -> StaticInfo OcDispatcher.BeginInvoke -> OcDispatcher.InvokeAsync Configuration -> OcConfiguration * API changed — Binding - +— StaticInfo 2.1.0 ObservableComputations ObservableComputations diff --git a/src/ObservableComputations/OcDispatcher.cs b/src/ObservableComputations/OcDispatcher.cs index 8873ccd..6e05dab 100644 --- a/src/ObservableComputations/OcDispatcher.cs +++ b/src/ObservableComputations/OcDispatcher.cs @@ -7,6 +7,7 @@ using System.ComponentModel; using System.Diagnostics; using System.Globalization; +using System.Linq; using System.Threading; using System.Threading.Tasks; using ThreadState = System.Threading.ThreadState; @@ -188,7 +189,10 @@ public NewInvocationBehaviour NewInvocationBehaviour } } - public int GetQueueCount(int priority = 0) => _invocationQueues[priority].Count; + public int GetQueueCount(int? priority = null) => + priority == null + ? _invocationQueues.Sum(q => q.Count) + : _invocationQueues[priority.Value].Count; internal Invocation queueInvocation(Action action, int priority, object context, bool setSynchronizationContext, Invocation parent, ManualResetEventSlim doneManualResetEvent = null)