public static void ShowResultDialog (this ProgressMonitor monitor)
		{
			if (monitor.Errors.Length == 1 && !monitor.HasWarnings) {
				MessageService.ShowError (monitor.Errors [0].Message, monitor.Errors [0].Exception);
			}
			else if (!monitor.HasErrors && monitor.Warnings.Length == 1) {
				MessageService.ShowWarning (monitor.Warnings[0]);
			}
			else if (monitor.HasErrors || monitor.HasWarnings) {
				using (var resultDialog = new MultiMessageDialog () {
					Modal = true,
				}) {
					foreach (var m in monitor.Errors)
						resultDialog.AddError (m.DisplayMessage);
					foreach (var m in monitor.Warnings)
						resultDialog.AddWarning (m);
					MessageService.ShowCustomDialog (resultDialog);
				}
			}
		}
		protected override void OnCompleted ()
		{
			if (lockGui)
				IdeApp.Workbench.UnlockGui ();
			
			statusBar.Dispose ();

			if (Errors.Count > 0 || Warnings.Count > 0) {
				if (Errors.Count > 0) {
					Gtk.Image img = ImageService.GetImage (Stock.Error, Gtk.IconSize.Menu);
					IdeApp.Workbench.StatusBar.ShowMessage (img, Errors [Errors.Count - 1]);
				} else if (SuccessMessages.Count == 0) {
					Gtk.Image img = ImageService.GetImage (Stock.Warning, Gtk.IconSize.Menu);
					IdeApp.Workbench.StatusBar.ShowMessage (img, Warnings [Warnings.Count - 1]);
				}
				
				base.OnCompleted ();
				
				if (showErrorDialogs) {
					MultiMessageDialog resultDialog = new MultiMessageDialog ();
					foreach (string m in Errors)
						resultDialog.AddError (m);
					foreach (string m in Warnings)
						resultDialog.AddWarning (m);
					resultDialog.TransientFor = IdeApp.Workbench.RootWindow;
					resultDialog.Run ();
					resultDialog.Destroy ();
				}
				IdeApp.Workbench.StatusBar.SetMessageSourcePad (statusSourcePad);
				return;
			}
			
			if (SuccessMessages.Count > 0)
				IdeApp.Workbench.StatusBar.ShowMessage (SuccessMessages [SuccessMessages.Count - 1]);
			
			IdeApp.Workbench.StatusBar.SetMessageSourcePad (statusSourcePad);
			base.OnCompleted ();
		}
Esempio n. 3
0
 protected void ShowResultDialog()
 {
     if (Errors.Count == 1 && Warnings.Count == 0) {
         if (ErrorException != null)
             MessageService.ShowException (ErrorException, Errors[0]);
         else
             MessageService.ShowError (Errors[0]);
     }
     else if (Errors.Count == 0 && Warnings.Count == 1) {
         MessageService.ShowWarning (Warnings[0]);
     }
     else if (Errors.Count > 0 || Warnings.Count > 0) {
         var resultDialog = new MultiMessageDialog () {
             Modal = true,
         };
         foreach (string m in Errors)
             resultDialog.AddError (m);
         foreach (string m in Warnings)
             resultDialog.AddWarning (m);
         MessageService.ShowCustomDialog (resultDialog);
     }
 }
		protected void ShowResultDialog ()
		{
			if (Errors.Count == 1 && Warnings.Count == 0) {
				if (ErrorException != null)
					MessageService.ShowException (ErrorException, Errors[0]);
				else
					MessageService.ShowError (Errors[0]);
			}
			else if (Errors.Count == 0 && Warnings.Count == 1) {
				MessageService.ShowWarning (Warnings[0]);
			}
			else if (Errors.Count > 0 || Warnings.Count > 0) {
				MultiMessageDialog resultDialog = new MultiMessageDialog ();
				foreach (string m in Errors)
					resultDialog.AddError (m);
				foreach (string m in Warnings)
					resultDialog.AddWarning (m);
				resultDialog.Run ();
				resultDialog.Destroy ();
			}
		}