/// <summary> /// Show the progress dialog to to the user. /// </summary> /// <param name="task">The <see cref="BackgroundTask"/> to execute.</param> /// <param name="desktopWindow">Desktop window that parents the progress dialog.</param> /// <param name="autoClose">Close the progress dialog after task completion.</param> /// <param name="progressBarStyle">The style of the progress bar.</param> public static void Show(BackgroundTask task, IDesktopWindow desktopWindow, bool autoClose = true, ProgressBarStyle progressBarStyle = ProgressBarStyle.Blocks, string startProgressMessage = null) { // as the progress dialog involves UI, the task should *always* be run under the application UI culture task.ThreadUICulture = Application.CurrentUICulture; var progressComponent = new ProgressDialogComponent(task, autoClose, progressBarStyle, startProgressMessage); ApplicationComponentExitCode result = ApplicationComponent.LaunchAsDialog( desktopWindow, progressComponent, Application.Name); if (result == ApplicationComponentExitCode.Error) { throw progressComponent.TaskException; } }
public void ShowDialogBox() { ApplicationComponent.LaunchAsDialog(this.Host.DesktopWindow, new TestComponent("Dialog from " + _name), "Dialog from " + _name); }