예제 #1
0
		/// <summary>
		/// This constructor provides the option of making the ProgressDialog modal.
		/// </summary>
		/// <param name="parentForm">The parent, or owning form for the ProgressDialog</param>
		/// <param name="command">The AsyncCommand c</param>
		/// <param name="progressTitleText">The title to use on the ProgressDialog</param>
		/// <param name="showModally">true if you want to use this modally, false otherwise. If you pass true, you must use ShowModal later to show the ProgressDialog</param>
		public ProgressDialogHandler(Form parentForm, BasicCommand command, string progressTitleText, bool showModally)
		{
			_parentForm = parentForm;
			_currentCommand = command;
			command.InitializeCallback = InitializeProgress;
			command.ProgressCallback = UpdateProgress;
			command.PrimaryStatusTextCallback = UpdateStatus1;
			command.SecondaryStatusTextCallback = UpdateOverview;

			_currentCommand.BeginCancel += OnCommand_BeginCancel;
			_currentCommand.EnabledChanged += OnCommand_EnabledChanged;
			_currentCommand.Error += OnCommand_Error;
			_currentCommand.Finish += OnCommand_Finish;

			_progressDialog = new ProgressDialog
								{
									Text = progressTitleText
								};
			_progressDialog.CancelRequested += _progressDialog_Cancelled;
			_progressDialog.Owner = parentForm;
			_progressDialog.CanCancel = true;
			//To use this progress in a modal way you need to call ShowModal after you have setup the ProgressDialogState
			if (!showModally)
			{
				//if it is not modal then we can show the dialog and it won't inhibit the rest of the setup and calling.
				_progressDialog.Show();
			}
		}
예제 #2
0
		/// <summary>
		/// This constructor will immediately show the ProgressDialog in a non-modal fashion.
		/// </summary>
		/// <param name="parentForm">The parent, or owning form for the ProgressDialog</param>
		/// <param name="command">The AsyncCommand c</param>
		/// <param name="progressTitleText">The title to use on the ProgressDialog</param>
		public ProgressDialogHandler(Form parentForm, BasicCommand command, string progressTitleText)
			: this(parentForm, command, progressTitleText, false)
		{
		}
예제 #3
0
		/// <summary>
		/// This constructor will immediately show the ProgressDialog in a non-modal fashion.
		/// </summary>
		/// <param name="parentForm">The parent, or owning form for the ProgressDialog</param>
		/// <param name="command">The AsyncCommand c</param>
		public ProgressDialogHandler(Form parentForm, BasicCommand command)
			: this(parentForm, command, "From Handler for: " + command.GetType())
		{
		}