C# Класс Nexus.Client.ThreadedBackgroundTask

A base class for tasks that run in a background thread.
This class implements some base functionality, making writing backgounrd tasks simpler. This class handles running the task in a thread. To implement the background task, you must provide a public method that calls one of the Start or StartWait methods. If threading management is not desired, use BackgroundTask instead.
Наследование: BackgroundTask
Показать файл Открыть проект

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

Метод Описание
ThreadedBackgroundTask ( ) : System

The default constructor.

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

Метод Описание
DoWork ( object p_objArgs ) : object

The method that is called to start the backgound task.

DoWork ( object p_objArgs, string &p_strMessage ) : object

The method that is called to start the backgound task.

OnTaskEnded ( TaskEndedEventArgs e ) : void

Raises the IBackgroundTask.TaskEnded event.

This signals the StartWait(bool, object[]) method that the task has ended, and makes the return value accessible to said method.

Start ( ) : void

Starts the task in a foreground thread.

Start ( bool p_booRunInBackground ) : void

Starts the task, optionally in a background thread.

If the task is started in a background thread, the task will be terminated in the calling thread terminates. Otherwise, the calling thread will not terminate until the task completes.

StartWait ( ) : object

Starts the task in a foreground thread, and waits until the task completes.

StartWait ( bool p_booRunInBackground ) : object

Starts the task, optionally in a background thread, and waits until the task completes.

If the task is started in a background thread, the task will be terminated in the calling thread terminates. Otherwise, the calling thread will not terminate until the task completes.

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

Метод Описание
EndThreadInvokeHandler ( IAsyncResult p_asrResult ) : void

The callback use by the BeginInvoke method that runs the work in the background.

RunThread ( object p_objArgs ) : void

A wrapper to the work method called by the thread to start the work.

RunThreadedWork ( object p_objArgs ) : object

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

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

The method that is called to start the backgound task.
protected DoWork ( object p_objArgs ) : object
p_objArgs object Arguments to for the task execution.
Результат object

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

The method that is called to start the backgound task.
protected DoWork ( object p_objArgs, string &p_strMessage ) : object
p_objArgs object Arguments to for the task execution.
p_strMessage string The message describing the state of the task.
Результат object

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

Raises the IBackgroundTask.TaskEnded event.
This signals the StartWait(bool, object[]) method that the task has ended, and makes the return value accessible to said method.
protected OnTaskEnded ( TaskEndedEventArgs e ) : void
e Nexus.Client.BackgroundTasks.TaskEndedEventArgs A describing the event arguments.
Результат void

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

Starts the task in a foreground thread.
protected Start ( ) : void
Результат void

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

Starts the task, optionally in a background thread.
If the task is started in a background thread, the task will be terminated in the calling thread terminates. Otherwise, the calling thread will not terminate until the task completes.
protected Start ( bool p_booRunInBackground ) : void
p_booRunInBackground bool Whether the task should be run in a background thread.
Результат void

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

Starts the task in a foreground thread, and waits until the task completes.
protected StartWait ( ) : object
Результат object

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

Starts the task, optionally in a background thread, and waits until the task completes.
If the task is started in a background thread, the task will be terminated in the calling thread terminates. Otherwise, the calling thread will not terminate until the task completes.
protected StartWait ( bool p_booRunInBackground ) : object
p_booRunInBackground bool Whether the task should be run in a background thread.
Результат object

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

The default constructor.
public ThreadedBackgroundTask ( ) : System
Результат System