C# Class Nexus.Client.BackgroundTasks.UI.ProgressDialog

This is a window that displays the progress of a IBackgroundTask
Inheritance: System.Windows.Forms.Form
Exibir arquivo Open project: NexusMods/NexusModManager-4.5

Public Methods

Method Description
ShowDialog ( IBackgroundTask p_bgtTask ) : DialogResult

Shows the progress dialog as a modal window.

ShowDialog ( IWin32Window p_winOwner, IBackgroundTask p_bgtTask ) : DialogResult

Shows the progress dialog as a modal window that is a child of the given owner.

Protected Methods

Method Description
OnClosing ( CancelEventArgs e ) : void

Raises the Form.Closing event.

This prevents the form from closing until the task has completed.

OnShown ( EventArgs e ) : void

Raises the Form.Shown event.

This immediately closes the form if the task has already completed.

ProgressDialog ( IBackgroundTask p_bgtTask ) : System

A simple constructor that initializes the object with the given values.

Private Methods

Method Description
DoDispose ( ) : void

Allows extension of the dispose method.

This unwires listeners that are wired to object on other threads. This is because if the form is closed before the threads are finished the threads may raise events to which we are listening, which will cause access to the control after it has been disposed (which will raise an exception).

HandleChangedProperty ( string p_strPropertyName ) : void

Updates the form to display the changed property.

Task_PropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Handles the INotifyPropertyChanged.PropertyChanged event of the task.

This updates the progress bars and messages.

Task_TaskEnded ( object sender, TaskEndedEventArgs e ) : void

Handles the IBackgroundTask.TaskEnded event of the task.

This sets the Form.DialogResult, dependant upon whether or not the task was cancelled.

butCancel_Click ( object sender, EventArgs e ) : void

Handles the Control.Click event of the cancel button.

This asks the BackgroundWorker to cancel. It also disables the cancel button to let the user know the process is cancelling.

Method Details

OnClosing() protected method

Raises the Form.Closing event.
This prevents the form from closing until the task has completed.
protected OnClosing ( CancelEventArgs e ) : void
e CancelEventArgs A describing the event arguments.
return void

OnShown() protected method

Raises the Form.Shown event.
This immediately closes the form if the task has already completed.
protected OnShown ( EventArgs e ) : void
e System.EventArgs An describing the event arguments.
return void

ProgressDialog() protected method

A simple constructor that initializes the object with the given values.
protected ProgressDialog ( IBackgroundTask p_bgtTask ) : System
p_bgtTask IBackgroundTask The whose progress is to be displayed.
return System

ShowDialog() public static method

Shows the progress dialog as a modal window.
public static ShowDialog ( IBackgroundTask p_bgtTask ) : DialogResult
p_bgtTask IBackgroundTask The whose progress is to be displayed.
return DialogResult

ShowDialog() public static method

Shows the progress dialog as a modal window that is a child of the given owner.
public static ShowDialog ( IWin32Window p_winOwner, IBackgroundTask p_bgtTask ) : DialogResult
p_winOwner IWin32Window The owner of the dialog.
p_bgtTask IBackgroundTask The whose progress is to be displayed.
return DialogResult