/// <summary> /// Helper to set the current progress category /// </summary> /// <param name="category"></param> private void SetCurrentCategory(ProgressCategory category) { if (progressCategory != category) { progressCategory = category; if (ProgressCategoryChanged != null) { ProgressCategoryChanged(this, EventArgs.Empty); } } }
/// <summary> /// Adds a new ProgressOperation to the list of work to perform and assigns the operation /// the number of ticks that it should take up in the overall operation. /// </summary> /// <param name="operation">the progress-compatible method that will do some work</param> /// <param name="completed">method called when the operation is completed</param> /// <param name="tickSize">an arbitrary number that should reflect the percentage of the work that will be done by this operation. /// Note: longer running operations should have a larger tick count than fast executing operations.</param> public void AddProgressOperation(ProgressOperation operation, ProgressCategory category, ProgressOperationCompleted completed, int tickSize) { // if a category is being specified then the connected UI should know that // it can and should show categories if (category != null) showCategories = true; //wrap the operation with a ProgressWorker that can manage its execution ProgressWorker worker = new ProgressWorker(operation, category, completed, tickSize, 100, this); //add the worker to the list workers.Add(worker); //add the ticks assigned to this task to the overall tick count totalProgressTicks += tickSize; }
/// <summary> /// Adds a new ProgressOperation to the list of work to perform and assigns the operation /// the number of ticks that it should take up in the overall operation. /// </summary> /// <param name="operation">the progress-compatible method that will do some work</param> /// <param name="completed">method called when the operation is completed</param> /// <param name="tickSize">an arbitrary number that should reflect the percentage of the work that will be done by this operation. /// Note: longer running operations should have a larger tick count than fast executing operations.</param> public void AddProgressOperation(ProgressOperation operation, ProgressCategory category, ProgressOperationCompleted completed, int tickSize) { // if a category is being specified then the connected UI should know that // it can and should show categories if (category != null) { showCategories = true; } //wrap the operation with a ProgressWorker that can manage its execution ProgressWorker worker = new ProgressWorker(operation, category, completed, tickSize, 100, this); //add the worker to the list workers.Add(worker); //add the ticks assigned to this task to the overall tick count totalProgressTicks += tickSize; }
/// <summary> /// Adds a new ProgressOperation to the list of work to perform and assigns the operation /// the number of ticks that it should take up in the overall operation. /// </summary> /// <param name="operation">the progress-compatible method that will do some work</param> /// <param name="tickSize">an arbitrary number that should reflect the percentage of the work that will be done by this operation. /// Note: longer running operations should have a larger tick count than fast executing operations.</param> public void AddProgressOperation(ProgressOperation operation, ProgressCategory progressCategory, int tickSize) { AddProgressOperation(operation, progressCategory, null, tickSize); }
/// <summary> /// Helper to set the current progress category /// </summary> /// <param name="category"></param> private void SetCurrentCategory(ProgressCategory category) { if (progressCategory != category) { progressCategory = category; if (ProgressCategoryChanged != null) ProgressCategoryChanged(this, EventArgs.Empty); } }