Click here to Skip to main content
15,894,896 members
Articles / Desktop Programming / Windows Forms

Progress Reporting Framework

Rate me:
Please Sign up or sign in to vote.
4.82/5 (10 votes)
7 Sep 2011CPOL9 min read 31.3K   836   51  
Reporting Progress for Complex Algorithms
// This file is part of the ProgressTracker library
// Copyright: Andreas Raczek
// This file is published under the The Code Project Open License (CPOL) 
// See the file "CPOL.html" for the full license governing this code. 

namespace ProgressTracker
{
    /// <summary>
    /// Represents an array of equal-sized progress steps 
    /// </summary>
    public class EvenSteps : IWeightedSteps
    {
        /// <summary>
        /// Initializes a new instance of the EvenSteps class.
        /// Should be used in the form <code>IProgressUpdater.createSteps(new EvenSteps(200));</code>
        /// </summary>
        /// <param name="stepCount">The number of steps for this Updater.</param>
        public EvenSteps(int stepCount)
        {
            this.Length = stepCount;
        }

        /// <summary>
        /// <see cref="IWeightedSteps.Length"/>
        /// </summary>
        public int Length
        {
            get;
            private set;
        }

        /// <summary>
        /// <see cref="IWeightedSteps.SumWeight"/>
        /// </summary>
        public double SumWeight
        {
            get { return 1.0; }
        }

        /// <summary>
        /// <see cref="IWeightedSteps.this"/>
        /// </summary>
        public double this[int index]
        {
            get
            {
                return 1.0d / this.Length;
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions