Class CadProgressMeter
- Namespace
- OpenCAD2D
- Assembly
- OpenCAD2D.Core.dll
One meter of the status bar, started by Start(string), as AutoCAD's ProgressMeter: given a limit (SetLimit(int)) and moved a step at a time (MeterProgress()), or told a share of 0 to 1 as an IProgress<T> (Report(double)), as SaveAs(string, IProgress<double>) tells it; indeterminate, a sweep with no percent, until either. Stopping it, or disposing of it, takes it off the status bar; a meter stopped is not moved again.
public sealed class CadProgressMeter : IProgress<double>, IDisposable
- Inheritance
-
CadProgressMeter
- Implements
- Inherited Members
Remarks
A meter may be moved on any thread. It counts in whole percent: a step or a share that leaves the percent as it was costs a few instructions and tells nothing, so a loop over a million objects can move it at each one.
Properties
- IsIndeterminate
Gets whether it is indeterminate: given neither a limit nor a share yet.
- IsRunning
Gets whether it runs: started and not yet stopped.
- Label
Gets what the status bar says of it, as "Saving plan.dwg".
- Limit
Gets the number of steps it was given by SetLimit(int); 0 for none.
- Percent
Gets the whole percent it shows, 0 to 100; -1 while it is indeterminate.
- Position
Gets the steps made since the limit was set.
Methods
- MeterProgress()
Moves it one step of its limit, as AutoCAD's MeterProgress; a step past the limit leaves it at 100 %, and one with no limit set does nothing.
- Report(double)
Shows a share of the work done, 0 to 1, as a whole percent rounded down: 0.405 shows 40 %. A share below 0 is 0, one above 1 is 1, and one that is not a number is not shown.
- SetLimit(int)
Sets the number of steps the work takes, the meter going back to 0 %, as AutoCAD's SetLimit; 0 makes it indeterminate again.
- Stop()
Stops it, taking it off the status bar and showing the meter under it, if any; stopping it again does nothing.