public ProgressWorker(ProgressOperation method, ProgressCategory category, ProgressOperationCompleted completedMethod, int progressSize, int progressTotal, IProgressHost progress) { WorkerMethod = method; _category = category; CompletedMethod = completedMethod; ProgressSize = progressSize; ParentProgress = progress; TotalProgressTicks = progressTotal; }
/// <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="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, ProgressOperationCompleted completed, int tickSize) { AddProgressOperation(operation, null, completed, tickSize); }
public ProgressWorker(ProgressOperation method, ProgressOperationCompleted completedMethod, int progressSize, int progressTotal, IProgressHost progress) : this(method, null, completedMethod, progressSize, progressTotal, progress) { }