C# Class HFMCmd.ProgressMonitor

Utility class that can be used to monitor the progress of long-running operations via a separate thread. Supports both synchronous and asyncrhonous modes of operation (i.e. where the long-running operation is blocking or non-blocking).
Afficher le fichier Open project: agardiner/hfmcmd

Méthodes publiques

Свойство Type Description
PollingInterval int

Protected Properties

Свойство Type Description
SLEEP_INTERVAL int
_log log4net.ILog
_monitorThread Thread
_output IOutput

Méthodes publiques

Méthode Description
AsyncComplete ( ) : void

When an async operation is complete, this method should be called so that the main thread waits for the monitor thread to end and clean up the progress display.

MonitorProgress ( GetProgress progressFn ) : void

Monitors progress of an operation executing asynchronously in another thread. The supplied callback is used to determine the completion progress of the operation, and whether or not it is still running. This method blocks until the callback sets the isRunning parameter to false, or the IOutput instance indicates the operation should be cancelled, e.g. because the user hits the Escape key. For a non-blocking alternative, use MonitorProgressAsync.

MonitorProgressAsync ( GetProgress progressFn ) : void

Monitors progress of a synchronously executing (i.e. blocking) operation. This method spins up a background thread to poll the operation status, and so it returns immediately. Use this method when you want to monitor the progress of a long-running, blocking operation. Be sure to call this method immediately prior to invoking the operation.

ProgressMonitor ( IOutput output ) : System

Constructs a progress monitor for tracking the progress of a long- running operation and updating the progress status via an IOutput instance. Progress will be measured in percentage terms.

Method Details

AsyncComplete() public méthode

When an async operation is complete, this method should be called so that the main thread waits for the monitor thread to end and clean up the progress display.
public AsyncComplete ( ) : void
Résultat void

MonitorProgress() public méthode

Monitors progress of an operation executing asynchronously in another thread. The supplied callback is used to determine the completion progress of the operation, and whether or not it is still running. This method blocks until the callback sets the isRunning parameter to false, or the IOutput instance indicates the operation should be cancelled, e.g. because the user hits the Escape key. For a non-blocking alternative, use MonitorProgressAsync.
public MonitorProgress ( GetProgress progressFn ) : void
progressFn GetProgress
Résultat void

MonitorProgressAsync() public méthode

Monitors progress of a synchronously executing (i.e. blocking) operation. This method spins up a background thread to poll the operation status, and so it returns immediately. Use this method when you want to monitor the progress of a long-running, blocking operation. Be sure to call this method immediately prior to invoking the operation.
public MonitorProgressAsync ( GetProgress progressFn ) : void
progressFn GetProgress
Résultat void

ProgressMonitor() public méthode

Constructs a progress monitor for tracking the progress of a long- running operation and updating the progress status via an IOutput instance. Progress will be measured in percentage terms.
public ProgressMonitor ( IOutput output ) : System
output IOutput
Résultat System

Property Details

PollingInterval public_oe property

public int PollingInterval
Résultat int

SLEEP_INTERVAL protected_oe static_oe property

protected static int SLEEP_INTERVAL
Résultat int

_log protected_oe static_oe property

protected static ILog,log4net _log
Résultat log4net.ILog

_monitorThread protected_oe property

protected Thread _monitorThread
Résultat Thread

_output protected_oe property

protected IOutput _output
Résultat IOutput