public MessageDialogProgressMonitor (bool showProgress, bool allowCancel, bool showDetails, bool hideWhenDone)
		{
			if (showProgress) {
				dialog = new ProgressDialog (allowCancel, showDetails);
				dialog.Message = "";
				MessageService.PlaceDialog (dialog, MessageService.RootWindow);
				dialog.Show ();
				dialog.AsyncOperation = AsyncOperation;
				DispatchService.RunPendingEvents ();
				this.hideWhenDone = hideWhenDone;
				this.showDetails = showDetails;
			}
		}
		public MessageDialogProgressMonitor (bool showProgress, bool allowCancel, bool showDetails, bool hideWhenDone): base (Runtime.MainSynchronizationContext)
		{
			if (showProgress) {
				dialog = new ProgressDialog (MessageService.RootWindow, allowCancel, showDetails);
				dialog.Message = "";
				MessageService.PlaceDialog (dialog, MessageService.RootWindow);
				dialog.Show ();
				dialog.CancellationTokenSource = CancellationTokenSource;
				DispatchService.RunPendingEvents ();
				this.hideWhenDone = hideWhenDone;
				this.showDetails = showDetails;
			}
		}
 public MessageDialogProgressMonitor(bool showProgress, bool allowCancel, bool showDetails, bool hideWhenDone)
 {
     if (showProgress) {
         dialog = new ProgressDialog (MessageService.RootWindow, allowCancel, showDetails);
         dialog.Message = "";
         MessageService.PlaceDialog (dialog, MessageService.RootWindow);
         dialog.Show ();
         dialog.AsyncOperation = AsyncOperation;
         dialog.OperationCancelled += delegate {
             OnCancelRequested ();
         };
         RunPendingEvents ();
         this.hideWhenDone = hideWhenDone;
         this.showDetails = showDetails;
     }
 }
		protected override void Run ()
		{
			_progress = 0;

			SolutionItem item = GetTargettedSolutionItem ();

			if (item == null) {
				Console.WriteLine ("Can't process project because no solution items are active.");
				return;
			}


			_dialog = new ProgressDialog (IdeApp.Workbench.RootWindow, true, true);
			_dialog.Title = CommandName;
			_dialog.Show ();

			bool success;
			string message = "";
			try {
				success = Execute (item, out message);
			}
			catch (Exception ex) {
				message = "Command failed.";
				CommandStatus ("Failed to execute command: " + ex.Message);
				CommandStatus ("Please file a bug report at https://github.com/matthew-ch-robbins/monodevelop-addin-packager");
				success = false;
			}


			_dialog.Progress = 1.0;
			_dialog.Message = message;

			if (success) {
				_dialog.Hide ();
			}
		}
			internal CommandTaskScope(ProgressDialog dialog, string taskMessage)
			{
				this.dialog = dialog;
				dialog.BeginTask(taskMessage);
			}