C# Класс GpsBroadcaster.Task

A class that represents a unit of work to be done. At the choice of the user, this can either be executed synchronously on the current thread or the GUI thread, or be executed asynchronously on a background worker. In either case, it will be able to report back on the GUI thread when the work is done. And if you choose to use an asynchronous operation, then it can also report back progress.
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
Completed void

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

Метод Описание
BeginExecute ( ) : void

Method to start running this task asynchronously. This can only be used if the enum TaskHandler.Background was specified to the constructor of the class.

Cancel ( ) : void

This method cancels the task. This only works for TaskHandlers of type background.

Execute ( ) : void

Method to start running this task synchronously, either on the current thread or on the GUI thread. This can only be used if the enum TaskHandler.Dispatcher or TaskHandler.ThisThread was specified to the constructor.

Task ( Dispatcher dispatcher, TaskHandler handler ) : System

Constructor for the task.

Защищенные методы

Метод Описание
Execute ( Object sender, DoWorkEventArgs args ) : void

Abstract method to be overridden that represents the work being done by the task.

ReportProgress ( Int32 percent, Object userState ) : void

Method used to report the progress being done by the task.

Приватные методы

Метод Описание
Completed ( Object sender, RunWorkerCompletedEventArgs args ) : void

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

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

Method to start running this task asynchronously. This can only be used if the enum TaskHandler.Background was specified to the constructor of the class.
public BeginExecute ( ) : void
Результат void

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

This method cancels the task. This only works for TaskHandlers of type background.
public Cancel ( ) : void
Результат void

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

Method to start running this task synchronously, either on the current thread or on the GUI thread. This can only be used if the enum TaskHandler.Dispatcher or TaskHandler.ThisThread was specified to the constructor.
public Execute ( ) : void
Результат void

Execute() защищенный абстрактный Метод

Abstract method to be overridden that represents the work being done by the task.
protected abstract Execute ( Object sender, DoWorkEventArgs args ) : void
sender Object
args System.ComponentModel.DoWorkEventArgs
Результат void

ReportProgress() защищенный Метод

Method used to report the progress being done by the task.
protected ReportProgress ( Int32 percent, Object userState ) : void
percent System.Int32 An Int32 representing the progress.
userState Object An arbitary userState object to describe the state of the operation.
Результат void

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

Constructor for the task.
public Task ( Dispatcher dispatcher, TaskHandler handler ) : System
dispatcher System.Windows.Threading.Dispatcher
handler TaskHandler Is an enum representing how this task should be executed.
Результат System