Table of Contents

Class CadProgress

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Core.dll

The progress meter of the status bar, as AutoCAD's: OPEN, SAVE and SAVEAS start one, and a command, a plugin or the host starts its own with Start(string) for any long work. The meter last started and not yet stopped is the one shown: one started while another runs, as a plugin's inside SAVE, is shown in its place, and the one under it comes back when it stops.

public sealed class CadProgress
Inheritance
CadProgress
Inherited Members

Remarks

Meters may be started, moved and stopped on any thread. Changed is raised on the thread that made the change, and only when what is shown changes: a meter started or stopped, or the meter shown moved by a whole percent, so that a drawing of 100 000 lines moves it at most 100 times however often it is told.

using (CadProgressMeter meter = context.Progress.Start("Checking blocks"))
{
    meter.SetLimit(blocks.Count);
    foreach (var block in blocks) { Check(block); meter.MeterProgress(); }
}                                    // stopped, even where Check throws

Properties

Depth

Gets how many meters are running, the one shown and those under it.

IsBusy

Gets whether a meter is running.

Shown

Gets the meter shown: the one last started and not yet stopped; null with none running.

Methods

Start(string)

Starts a meter, shown at once in the place of the one shown before: indeterminate until it is given a limit (SetLimit(int)) or a share (Report(double)). Stop it, or dispose of it, when the work ends; a using block stops it when the work throws.

Events

Changed

Raised, on the thread that made the change, when what the status bar shows of the meters changes.