C# Class 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.
Afficher le fichier Open project: bakacaptain/istalkapp

Private Properties

Свойство Type Description
Completed void

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
Completed ( Object sender, RunWorkerCompletedEventArgs args ) : void

Method Details

BeginExecute() public méthode

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
Résultat void

Cancel() public méthode

This method cancels the task. This only works for TaskHandlers of type background.
public Cancel ( ) : void
Résultat void

Execute() public méthode

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
Résultat void

Execute() protected abstract méthode

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
Résultat void

ReportProgress() protected méthode

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.
Résultat void

Task() public méthode

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.
Résultat System