Synchronous algorithm events
ILAlgorithm uses events to inform registered delegates about state, progress
and user defined data. Those events may be fired before, while and after time consuming algorithms.
Also the registrar may inform the ILAlgorithm about cancelation reguests in order to cancel the
current computation.
Instances of ILAlgorithm provide the following events:
| Event | ... is thrown on |
|---|---|
| StateChanged | state changes |
| ProgressChanged | progress changes |
The StateChanged event is fired from the ILAlgorithm class, whenever the state of the algorithm changes significantly.
Therefore the ILAlgorithmEventArgs event argument carries a variable of type ILAlgorithmState.
The enum reflect one of the state values: Initialized, Running, Finished, Canceled.
The StateChanged event gets fired every time the SetState method is executed. The implementor of the
ILAlgorithm derived class is responsible for calling SetState whenever needed. This should happen at least at
the beginning of any computations and at the time the computation has finished.
Run() method in order to set the state to running. Alternatively you may directly override the Run() method with your algorithm implementation.
The ProgressChanged event may be used to provide users of the algorithm with progress information.
Therefore the ILAlgorithmEventArgs event argument carries a variable of type double reflecting the new progress value.
The ProgressChanged event gets fired, every time the SetProgress method is executed. The designer of the
class is responsible for calling the SetProgress method frequently in order to realize a smooth progress display for the user of the class.