C# Класс 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).
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
PollingInterval int

Защищенные свойства (Protected)

Свойство Тип Описание
SLEEP_INTERVAL int
_log log4net.ILog
_monitorThread Thread
_output IOutput

Открытые методы

Метод Описание
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.

Описание методов

AsyncComplete() публичный Метод

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
Результат void

MonitorProgress() публичный Метод

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
Результат void

MonitorProgressAsync() публичный Метод

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
Результат void

ProgressMonitor() публичный Метод

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
Результат System

Описание свойств

PollingInterval публичное свойство

public int PollingInterval
Результат int

SLEEP_INTERVAL защищенное статическое свойство

protected static int SLEEP_INTERVAL
Результат int

_log защищенное статическое свойство

protected static ILog,log4net _log
Результат log4net.ILog

_monitorThread защищенное свойство

protected Thread _monitorThread
Результат Thread

_output защищенное свойство

protected IOutput _output
Результат IOutput