#region CPL License /* Nuclex Framework Copyright (C) 2002-2008 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #endregion using System; using System.Collections.Generic; namespace Nuclex.Support.Tracking { /// Waitable with an associated weight for the total progress public class WeightedWaitable where WaitableType : Waitable { /// /// Initializes a new weighted waitable with a default weight of 1.0 /// /// Waitable whose progress to monitor public WeightedWaitable(WaitableType waitable) : this(waitable, 1.0f) { } /// Initializes a new weighted waitable /// Waitable whose progress to monitor /// Weighting of the waitable's progress public WeightedWaitable(WaitableType waitable, float weight) { this.waitable = waitable; this.weight = weight; } /// Waitable being wrapped by this weighted waitable public WaitableType Waitable { get { return this.waitable; } } /// The contribution of this waitable to the total progress public float Weight { get { return this.weight; } } /// Waitable whose progress we're tracking private WaitableType waitable; /// Weighting of this waitable in the total progress private float weight; } } // namespace Nuclex.Support.Tracking