diff --git a/Nuclex.Support (PC).csproj b/Nuclex.Support (PC).csproj index 4a20885..517e18a 100644 --- a/Nuclex.Support (PC).csproj +++ b/Nuclex.Support (PC).csproj @@ -144,6 +144,10 @@ false ObservedProgression + + false + ProgressionTracker + false SetProgression diff --git a/Source/Collections/TransformingReadOnlyCollection.cs b/Source/Collections/TransformingReadOnlyCollection.cs index 567aabe..a74e1da 100644 --- a/Source/Collections/TransformingReadOnlyCollection.cs +++ b/Source/Collections/TransformingReadOnlyCollection.cs @@ -6,13 +6,29 @@ using System.Threading; namespace Nuclex.Support.Collections { - /// Collection transforming the contents of another collection. + /// Collection that transforms the contents of another collection. /// /// Type of the items contained in the wrapped collection. /// /// /// Type this collection exposes its items as. /// + /// + /// + /// This collection is useful if you want to expose the objects of an arbitrary + /// collection under a different type. It can be used, for example, to construct + /// wrappers for the items in a collection on-the-fly, eliminating the need to + /// manage the wrappers in parallel to the real items and improving performance + /// by only constructing a wrapper when an item is actually requested. + /// + /// + /// Another common use would be if you have a private collection of a non-public + /// type that's derived from some publicly visible type. By using this collection, + /// you can return the items under the publicly visible type while still having + /// your private collection under the non-public type, eliminating the need to + /// downcast each time you need to access elements of the non-public type. + /// + /// public abstract class TransformingReadOnlyCollection : IList, IList { @@ -241,23 +257,6 @@ namespace Nuclex.Support.Collections { /// protected abstract ExposedItemType Transform(ContainedItemType item); - /// - /// Determines whether the object is compatible to the collection's data type. - /// - /// Object to check for compatibility. - /// - /// True if the object is compatible to the collection's data type; - /// otherwise false. - /// - private static bool IsCompatibleObject(object value) { - if(!(value is ExposedItemType)) { - if((value != null) || typeof(ExposedItemType).IsValueType) { - return false; - } - } - return true; - } - #region IList Members /// diff --git a/Source/Scheduling/Operation.cs b/Source/Scheduling/Operation.cs index 51a3ef9..594a12e 100644 --- a/Source/Scheduling/Operation.cs +++ b/Source/Scheduling/Operation.cs @@ -8,7 +8,15 @@ namespace Nuclex.Support.Tracking { public abstract class Operation : Progression { /// Executes the operation - public abstract void Execute(); + public abstract void Start(); + + /// + /// Executes the operation synchronously, blocking the calling thread + /// + public virtual void Execute() { + Start(); + WaitHandle.WaitOne(); + } } diff --git a/Source/Tracking/ProgressionTracker.cs b/Source/Tracking/ProgressionTracker.cs new file mode 100644 index 0000000..4b9fb7f --- /dev/null +++ b/Source/Tracking/ProgressionTracker.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Nuclex.Support.Tracking { +/* + public abstract class ProgressionTracker { + + public void Track() {} + + protected virtual void OnStartTracking(); + protected virtual void OnEndTracking(); + protected virtual void OnProgressUpdated(); + + } +*/ +} // namespace Nuclex.Support.Tracking