bool CreateDialogForm()
        {
            if (collector.ProgressMonitorIsDisposed)
            {
                return(false);
            }

            dlg      = new AsynchronousWaitDialogForm(cancellation != null);
            dlg.Text = titleName;
            dlg.cancelButton.Click += CancelButtonClick;
            dlg.CreateControl();
            IntPtr h = dlg.Handle;             // force handle creation

            // ensure events occur on this thread, then register event handlers
            synchronizationHelper.SetTarget(dlg);
            collector.ProgressMonitorDisposed += progress_ProgressMonitorDisposed;
            collector.PropertyChanged         += progress_PropertyChanged;

            // check IsDisposed once again (we might have missed an event while we initialized the dialog):
            if (collector.ProgressMonitorIsDisposed)
            {
                dlg.Dispose();
                return(false);
            }

            progress_PropertyChanged(null, new System.ComponentModel.PropertyChangedEventArgs("TaskName"));

            return(true);
        }
예제 #2
0
        void Run()
        {
            Thread.Sleep(ShowWaitDialogDelay);
            bool isShowingDialog;

            lock (lockObject) {
                if (disposed)
                {
                    return;
                }
                dlg      = new AsynchronousWaitDialogForm();
                dlg.Text = StringParser.Parse(titleName);
                dlg.cancelButton.Click += CancelButtonClick;
                UpdateTask();
                dlg.CreateControl();
                IntPtr h = dlg.Handle;                 // force handle creation
                isShowingDialog = showingDialog;
            }
            if (isShowingDialog)
            {
                Application.Run();
            }
            else
            {
                Application.Run(dlg);
            }
        }
예제 #3
0
		void Run()
		{
			Thread.Sleep(ShowWaitDialogDelay);
			if (collector.ProgressMonitorIsDisposed)
				return;
			
			dlg = new AsynchronousWaitDialogForm(cancellation != null);
			dlg.Text = titleName;
			dlg.cancelButton.Click += CancelButtonClick;
			dlg.CreateControl();
			IntPtr h = dlg.Handle; // force handle creation
			
			// ensure events occur on this thread, then register event handlers
			synchronizationHelper.SetTarget(dlg);
			collector.ProgressMonitorDisposed += progress_ProgressMonitorDisposed;
			collector.PropertyChanged += progress_PropertyChanged;
			
			// check IsDisposed once again (we might have missed an event while we initialized the dialog):
			if (collector.ProgressMonitorIsDisposed) {
				dlg.Dispose();
				return;
			}
			
			progress_PropertyChanged(null, new System.ComponentModel.PropertyChangedEventArgs("TaskName"));
			
			if (collector.ShowingDialog) {
				Application.Run();
			} else {
				Application.Run(dlg);
			}
		}
		void Run()
		{
			Thread.Sleep(ShowWaitDialogDelay);
			bool isShowingDialog;
			lock (lockObject) {
				if (disposed)
					return;
				dlg = new AsynchronousWaitDialogForm();
				dlg.Text = StringParser.Parse(titleName);
				dlg.cancelButton.Click += CancelButtonClick;
				UpdateTask();
				dlg.CreateControl();
				IntPtr h = dlg.Handle; // force handle creation
				isShowingDialog = showingDialog;
			}
			if (isShowingDialog) {
				Application.Run();
			} else {
				Application.Run(dlg);
			}
		}