From a934fb155e4f29f07f37459afcef47b64c895dc1 Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Sat, 21 Jan 2017 22:08:24 +0000 Subject: [PATCH] Fixed async task notifications; added more comments; restored CancellationToken methods; removed useless usings git-svn-id: file:///srv/devel/repo-conversion/nusu@330 d2e56fa2-650e-0410-a79f-9358c0239efd --- Properties/AssemblyInfo.cs | 2 +- Source/Async/IAsyncAction.cs | 3 +-- Source/Async/IAsyncSwitch.cs | 3 +-- Source/Async/IAsyncTask.cs | 11 ++++------- Source/Collections/Deque.Insertion.cs | 2 -- Source/Collections/Deque.Removal.cs | 2 -- Source/Collections/Deque.Search.cs | 2 -- Source/Collections/Deque.cs | 1 - Source/Collections/IObservableCollection.cs | 2 -- Source/Collections/ItemEventArgs.cs | 1 - Source/Collections/ItemReplaceEventArgs.cs | 1 - Source/Collections/ObservableSet.cs | 1 - Source/Collections/Parentable.cs | 1 - Source/Collections/ParentingCollection.cs | 3 --- Source/Collections/Pool.cs | 1 - Source/Collections/PriorityItemPair.cs | 1 - Source/Collections/ReadOnlyDictionary.cs | 1 - Source/Collections/TransformingReadOnlyCollection.cs | 1 - Source/Collections/WeakCollection.cs | 1 - Source/EnumHelper.cs | 3 --- Source/FloatHelper.cs | 1 - Source/IO/ChainStream.cs | 1 - Source/IO/PartialStream.cs | 2 -- Source/IntegerHelper.cs | 1 - Source/Licensing/LicenseKey.cs | 1 - Source/Observable.cs | 1 + Source/ParallelBackgroundWorker.cs | 2 +- Source/Parsing/CommandLine.Argument.cs | 2 -- Source/Parsing/CommandLine.Formatter.cs | 1 - Source/Parsing/CommandLine.Parser.cs | 2 -- Source/Parsing/CommandLine.Test.cs | 2 -- Source/Parsing/CommandLine.cs | 2 -- Source/PropertyChangedEventArgsHelper.cs | 2 ++ Source/StringHelper.cs | 1 - Source/StringSegment.cs | 1 - Source/WeakReference.cs | 1 - Source/XmlHelper.cs | 2 -- 37 files changed, 11 insertions(+), 57 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 9df33e8..204363e 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyProduct("Nuclex.Support")] [assembly: AssemblyDescription("")] [assembly: AssemblyCompany("Nuclex Development Labs")] -[assembly: AssemblyCopyright("Copyright © Nuclex Development Labs 2008-2013")] +[assembly: AssemblyCopyright("Copyright © Nuclex Development Labs 2008-2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Source/Async/IAsyncAction.cs b/Source/Async/IAsyncAction.cs index 484b92b..7e47f71 100755 --- a/Source/Async/IAsyncAction.cs +++ b/Source/Async/IAsyncAction.cs @@ -19,6 +19,7 @@ License along with this library #endregion using System; +using System.Threading; namespace Nuclex.Support.Async { @@ -28,11 +29,9 @@ namespace Nuclex.Support.Async { /// Executes the action void Run(); -#if false /// Executes the action allowing cancellation via a cancellation token /// Cancellation token that can cancel the action void Run(CancellationToken cancellationToken); -#endif } diff --git a/Source/Async/IAsyncSwitch.cs b/Source/Async/IAsyncSwitch.cs index 0828600..80f74b5 100755 --- a/Source/Async/IAsyncSwitch.cs +++ b/Source/Async/IAsyncSwitch.cs @@ -19,6 +19,7 @@ License along with this library #endregion using System; +using System.Threading; namespace Nuclex.Support.Async { @@ -30,14 +31,12 @@ namespace Nuclex.Support.Async { /// Option or configuration to switch to void Switch(TOptions option); -#if false /// Switches to a different option or configuration /// Option or configuration to switch to /// /// Cancellation token by which the switch can be cancelled /// void Switch(TOptions option, CancellationToken cancellationToken); -#endif /// Current target option or configuration being switched to TOptions Target { get; } diff --git a/Source/Async/IAsyncTask.cs b/Source/Async/IAsyncTask.cs index affdf69..1cb7ed4 100755 --- a/Source/Async/IAsyncTask.cs +++ b/Source/Async/IAsyncTask.cs @@ -25,14 +25,11 @@ namespace Nuclex.Support.Async { /// Task that runs in the background or externally public interface IAsyncTask { - /// Triggered when the process starts running - event EventHandler Started; + /// Triggered when the status of the task changes + event EventHandler StatusChanged; - /// Triggered when the action finishes for any reason - event EventHandler Finished; - - /// Whether the action is currently running - bool IsRunning { get; } + /// Current status of the asynchronous task + AsyncStatus Status { get; } } diff --git a/Source/Collections/Deque.Insertion.cs b/Source/Collections/Deque.Insertion.cs index 0801fd0..af78f2c 100644 --- a/Source/Collections/Deque.Insertion.cs +++ b/Source/Collections/Deque.Insertion.cs @@ -19,8 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; -using System.Collections; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/Deque.Removal.cs b/Source/Collections/Deque.Removal.cs index a131567..06cc75c 100644 --- a/Source/Collections/Deque.Removal.cs +++ b/Source/Collections/Deque.Removal.cs @@ -19,8 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; -using System.Collections; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/Deque.Search.cs b/Source/Collections/Deque.Search.cs index 751a9d5..711c139 100644 --- a/Source/Collections/Deque.Search.cs +++ b/Source/Collections/Deque.Search.cs @@ -19,8 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; -using System.Collections; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/Deque.cs b/Source/Collections/Deque.cs index bda334b..68f24dd 100644 --- a/Source/Collections/Deque.cs +++ b/Source/Collections/Deque.cs @@ -21,7 +21,6 @@ License along with this library using System; using System.Collections.Generic; using System.Collections; -using System.Reflection; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/IObservableCollection.cs b/Source/Collections/IObservableCollection.cs index d890d90..e583d25 100644 --- a/Source/Collections/IObservableCollection.cs +++ b/Source/Collections/IObservableCollection.cs @@ -19,8 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/ItemEventArgs.cs b/Source/Collections/ItemEventArgs.cs index 2c8d45e..d485faf 100644 --- a/Source/Collections/ItemEventArgs.cs +++ b/Source/Collections/ItemEventArgs.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/ItemReplaceEventArgs.cs b/Source/Collections/ItemReplaceEventArgs.cs index b307b4b..5a8fba7 100644 --- a/Source/Collections/ItemReplaceEventArgs.cs +++ b/Source/Collections/ItemReplaceEventArgs.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/ObservableSet.cs b/Source/Collections/ObservableSet.cs index 26ff9d8..5d7ae59 100644 --- a/Source/Collections/ObservableSet.cs +++ b/Source/Collections/ObservableSet.cs @@ -20,7 +20,6 @@ License along with this library using System; using System.Collections.Generic; -using System.Linq; using System.Collections; #if !NO_SPECIALIZED_COLLECTIONS diff --git a/Source/Collections/Parentable.cs b/Source/Collections/Parentable.cs index 7393077..7b00196 100644 --- a/Source/Collections/Parentable.cs +++ b/Source/Collections/Parentable.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/ParentingCollection.cs b/Source/Collections/ParentingCollection.cs index 56dd738..dcd4925 100644 --- a/Source/Collections/ParentingCollection.cs +++ b/Source/Collections/ParentingCollection.cs @@ -19,10 +19,7 @@ License along with this library #endregion using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.IO; -using System.Reflection; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/Pool.cs b/Source/Collections/Pool.cs index c601780..79d0ecc 100644 --- a/Source/Collections/Pool.cs +++ b/Source/Collections/Pool.cs @@ -20,7 +20,6 @@ License along with this library using System; using System.Collections.Generic; -using System.Text; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/PriorityItemPair.cs b/Source/Collections/PriorityItemPair.cs index abb10f9..b31d1ca 100644 --- a/Source/Collections/PriorityItemPair.cs +++ b/Source/Collections/PriorityItemPair.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; using System.Text; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/ReadOnlyDictionary.cs b/Source/Collections/ReadOnlyDictionary.cs index 277fbe1..3026922 100644 --- a/Source/Collections/ReadOnlyDictionary.cs +++ b/Source/Collections/ReadOnlyDictionary.cs @@ -21,7 +21,6 @@ License along with this library using System; using System.Collections.Generic; using System.Collections; -using System.Collections.ObjectModel; using System.Runtime.Serialization; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/TransformingReadOnlyCollection.cs b/Source/Collections/TransformingReadOnlyCollection.cs index af2bc16..536d6a6 100644 --- a/Source/Collections/TransformingReadOnlyCollection.cs +++ b/Source/Collections/TransformingReadOnlyCollection.cs @@ -21,7 +21,6 @@ License along with this library using System; using System.Collections; using System.Collections.Generic; -using System.Collections.ObjectModel; namespace Nuclex.Support.Collections { diff --git a/Source/Collections/WeakCollection.cs b/Source/Collections/WeakCollection.cs index 020dfd7..b2565fe 100644 --- a/Source/Collections/WeakCollection.cs +++ b/Source/Collections/WeakCollection.cs @@ -21,7 +21,6 @@ License along with this library using System; using System.Collections; using System.Collections.Generic; -using System.Collections.ObjectModel; namespace Nuclex.Support.Collections { diff --git a/Source/EnumHelper.cs b/Source/EnumHelper.cs index 392f480..9a7628b 100644 --- a/Source/EnumHelper.cs +++ b/Source/EnumHelper.cs @@ -19,9 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; namespace Nuclex.Support { diff --git a/Source/FloatHelper.cs b/Source/FloatHelper.cs index 3697471..be69e3a 100644 --- a/Source/FloatHelper.cs +++ b/Source/FloatHelper.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; using System.Runtime.InteropServices; namespace Nuclex.Support { diff --git a/Source/IO/ChainStream.cs b/Source/IO/ChainStream.cs index 5a12b7d..f968b58 100644 --- a/Source/IO/ChainStream.cs +++ b/Source/IO/ChainStream.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Source/IO/PartialStream.cs b/Source/IO/PartialStream.cs index 801ba6c..91db86e 100644 --- a/Source/IO/PartialStream.cs +++ b/Source/IO/PartialStream.cs @@ -19,8 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; -using System.Diagnostics; using System.IO; namespace Nuclex.Support.IO { diff --git a/Source/IntegerHelper.cs b/Source/IntegerHelper.cs index ce545d1..e08fad5 100644 --- a/Source/IntegerHelper.cs +++ b/Source/IntegerHelper.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; namespace Nuclex.Support { diff --git a/Source/Licensing/LicenseKey.cs b/Source/Licensing/LicenseKey.cs index 167b907..8d2ac24 100644 --- a/Source/Licensing/LicenseKey.cs +++ b/Source/Licensing/LicenseKey.cs @@ -20,7 +20,6 @@ License along with this library using System; using System.Collections; -using System.IO; using System.Text; namespace Nuclex.Support.Licensing { diff --git a/Source/Observable.cs b/Source/Observable.cs index 6604cd4..5a1a76a 100644 --- a/Source/Observable.cs +++ b/Source/Observable.cs @@ -64,6 +64,7 @@ namespace Nuclex.Support { /// /// /// + [Obsolete("Prefer the C# 'nameof()' operator to using a Linq expression")] protected void OnPropertyChanged(Expression> property) { PropertyChangedEventHandler copy = PropertyChanged; if(copy != null) { diff --git a/Source/ParallelBackgroundWorker.cs b/Source/ParallelBackgroundWorker.cs index 17b968a..f0fd7c6 100644 --- a/Source/ParallelBackgroundWorker.cs +++ b/Source/ParallelBackgroundWorker.cs @@ -20,7 +20,7 @@ License along with this library #if !NO_CONCURRENT_COLLECTIONS -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading; diff --git a/Source/Parsing/CommandLine.Argument.cs b/Source/Parsing/CommandLine.Argument.cs index c736614..96076c9 100644 --- a/Source/Parsing/CommandLine.Argument.cs +++ b/Source/Parsing/CommandLine.Argument.cs @@ -19,8 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; -using System.Diagnostics; namespace Nuclex.Support.Parsing { diff --git a/Source/Parsing/CommandLine.Formatter.cs b/Source/Parsing/CommandLine.Formatter.cs index e43e413..9451b0b 100644 --- a/Source/Parsing/CommandLine.Formatter.cs +++ b/Source/Parsing/CommandLine.Formatter.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; using System.Text; namespace Nuclex.Support.Parsing { diff --git a/Source/Parsing/CommandLine.Parser.cs b/Source/Parsing/CommandLine.Parser.cs index e65fdb0..5003a83 100644 --- a/Source/Parsing/CommandLine.Parser.cs +++ b/Source/Parsing/CommandLine.Parser.cs @@ -20,8 +20,6 @@ License along with this library using System; using System.Collections.Generic; -using System.Diagnostics; -using System.IO; namespace Nuclex.Support.Parsing { diff --git a/Source/Parsing/CommandLine.Test.cs b/Source/Parsing/CommandLine.Test.cs index 7742d26..50de3cd 100644 --- a/Source/Parsing/CommandLine.Test.cs +++ b/Source/Parsing/CommandLine.Test.cs @@ -19,8 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; -using System.Text; #if UNITTEST diff --git a/Source/Parsing/CommandLine.cs b/Source/Parsing/CommandLine.cs index 3a07a33..80db373 100644 --- a/Source/Parsing/CommandLine.cs +++ b/Source/Parsing/CommandLine.cs @@ -23,8 +23,6 @@ using System.Collections.Generic; using System.IO; using System.Text; -using Nuclex.Support.Collections; - namespace Nuclex.Support.Parsing { /// Parses and stores an application's command line parameters diff --git a/Source/PropertyChangedEventArgsHelper.cs b/Source/PropertyChangedEventArgsHelper.cs index ff2f0cb..d7c0812 100644 --- a/Source/PropertyChangedEventArgsHelper.cs +++ b/Source/PropertyChangedEventArgsHelper.cs @@ -72,6 +72,7 @@ namespace Nuclex.Support { /// /// /// + [Obsolete("Prefer the C# 'nameof()' operator to using a Linq expression")] public static PropertyChangedEventArgs GetArgumentsFor( Expression> property ) { @@ -160,6 +161,7 @@ namespace Nuclex.Support { /// /// /// + [Obsolete("Prefer the C# 'nameof()' operator to using a Linq expression")] public static bool AreAffecting( this PropertyChangedEventArgs arguments, Expression> property ) { diff --git a/Source/StringHelper.cs b/Source/StringHelper.cs index 6ce54a2..57265bf 100644 --- a/Source/StringHelper.cs +++ b/Source/StringHelper.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; namespace Nuclex.Support { diff --git a/Source/StringSegment.cs b/Source/StringSegment.cs index eb45ce3..90fc9fa 100644 --- a/Source/StringSegment.cs +++ b/Source/StringSegment.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; using System.Runtime.InteropServices; namespace Nuclex.Support { diff --git a/Source/WeakReference.cs b/Source/WeakReference.cs index 2a18428..c432791 100644 --- a/Source/WeakReference.cs +++ b/Source/WeakReference.cs @@ -19,7 +19,6 @@ License along with this library #endregion using System; -using System.Collections.Generic; using System.Runtime.Serialization; namespace Nuclex.Support { diff --git a/Source/XmlHelper.cs b/Source/XmlHelper.cs index d0cf671..a272c03 100644 --- a/Source/XmlHelper.cs +++ b/Source/XmlHelper.cs @@ -19,9 +19,7 @@ License along with this library #endregion using System; -using System.Collections.Generic; using System.IO; -using System.Reflection; using System.Xml; #if !USE_XMLDOCUMENT using System.Xml.Linq;