C# Class SIL.FieldWorks.Common.Controls.ProgressDialogWithTask

A progress dialog (with an optional cancel button) that displays while a task runs in the background.
Inheritance: IAdvInd3, IAdvInd4, IFWDisposable
Afficher le fichier Open project: sillsdev/FieldWorks Class Usage Examples

Méthodes publiques

Méthode Description
CheckDisposed ( ) : void

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.

This method is thread safe.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

ImportTranslatedListsForWs ( Form parentWindow, FdoCache cache, string ws ) : void

I'd like to put all this logic into XmlTranslatedLists, because it is common to most cases of calling ImportTranslatedListsForWs, which is the point of this method. Unfortunately FDO cannot reference the DLL that has ProgressDialogWithTask. I've made it public static so that anything that references FwControls can use it at least.

ProgressDialogWithTask ( Form owner ) : System

Initializes a new instance of the ProgressDialogWithTask class that will create an actual progress dialog box to track the progress.

ProgressDialogWithTask ( ISynchronizeInvoke synchronizeInvoke ) : System

Initializes a new instance of the ProgressDialogWithTask class.

RunTask ( Func backgroundTask ) : object

If progress dialog is already showing, we run the background task using it (without creating a separate thread). Otherwise we display a new progress dialog as a modal dialog and start the background task in a separate thread.

RunTask ( bool fDisplayUi, Func backgroundTask ) : object

Displays the progress dialog as a modal dialog and starts the background task.

Step ( int cSteps ) : void

Steps the specified number of steps.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

m_progressDialog_Canceling ( object sender, System.CancelEventArgs e ) : void

Calls subscribers to the cancel event.

Private Methods

Méthode Description
AddStartListener ( ) : void
DialogShown ( ) : void
DialogShown ( object sender, EventArgs e ) : void
ImportTranslatedListsForWs ( IThreadedProgress dlg, object args ) : object

Method with required signature for ProgressDialogWithTask.RunTask, to invoke XmlTranslatedLists.ImportTranslatedListsForWs. Should only be called by the other overload of ImportTranslatedListsForWs. args must be a writing system identifier string and an FdoCache.

InitOnOwnerThread ( ) : void
LaunchDialogAndTask ( IWin32Window owner ) : void
ProgressDialogWithTask ( Form owner, ISynchronizeInvoke synchronizeInvoke ) : System

Initializes a new instance of the ProgressDialogWithTask class.

RemoveStartListener ( ) : void
RunBackgroundTask ( object sender, DoWorkEventArgs e ) : void

Executes the background task.

This method runs in the background thread!

m_progressDialog_FormClosing ( object sender, FormClosingEventArgs e ) : void
m_worker_RunWorkerCompleted ( object sender, RunWorkerCompletedEventArgs e ) : void

Method Details

CheckDisposed() public méthode

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
This method is thread safe.
public CheckDisposed ( ) : void
Résultat void

Dispose() public méthode

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

ImportTranslatedListsForWs() public static méthode

I'd like to put all this logic into XmlTranslatedLists, because it is common to most cases of calling ImportTranslatedListsForWs, which is the point of this method. Unfortunately FDO cannot reference the DLL that has ProgressDialogWithTask. I've made it public static so that anything that references FwControls can use it at least.
public static ImportTranslatedListsForWs ( Form parentWindow, FdoCache cache, string ws ) : void
parentWindow System.Windows.Forms.Form
cache FdoCache
ws string
Résultat void

ProgressDialogWithTask() public méthode

Initializes a new instance of the ProgressDialogWithTask class that will create an actual progress dialog box to track the progress.
public ProgressDialogWithTask ( Form owner ) : System
owner System.Windows.Forms.Form The form to use as the owner when creating the actual progress /// dialog.
Résultat System

ProgressDialogWithTask() public méthode

Initializes a new instance of the ProgressDialogWithTask class.
public ProgressDialogWithTask ( ISynchronizeInvoke synchronizeInvoke ) : System
synchronizeInvoke ISynchronizeInvoke
Résultat System

RunTask() public méthode

If progress dialog is already showing, we run the background task using it (without creating a separate thread). Otherwise we display a new progress dialog as a modal dialog and start the background task in a separate thread.
Wraps any exception thrown by the background /// task
public RunTask ( Func backgroundTask ) : object
backgroundTask Func The background task.
Résultat object

RunTask() public méthode

Displays the progress dialog as a modal dialog and starts the background task.
Wraps any exception thrown by the background /// task
public RunTask ( bool fDisplayUi, Func backgroundTask ) : object
fDisplayUi bool set to true to display the progress dialog, /// false to run without UI.
backgroundTask Func The background task.
Résultat object

Step() public méthode

Steps the specified number of steps.
public Step ( int cSteps ) : void
cSteps int The count of steps. If it's 0, step the default step size
Résultat void

m_progressDialog_Canceling() protected méthode

Calls subscribers to the cancel event.
protected m_progressDialog_Canceling ( object sender, System.CancelEventArgs e ) : void
sender object The sender.
e System.CancelEventArgs The instance containing the event data.
Résultat void