ExceptionDialogAction IExceptionDialog.Show(string title, string message, Exception e, ExceptionDialogActions actions)
        {
            Title     = title;
            Message   = message;
            Exception = e;
            Actions   = actions;

            return(Show());
        }
        private static void Show(string title, string message, Exception e, ExceptionDialogActions actions)
        {
            var result = Create().Show(title, message, e, actions);

            if (result == ExceptionDialogAction.Quit)
            {
                Application.Shutdown();
            }
        }
Пример #3
0
        internal ExceptionDialogControl(Exception exception, string message, ExceptionDialogActions buttonActions, ClickHandlerDelegate ok, ClickHandlerDelegate quit)
        {
            _exception = exception;

            InitializeComponent();

            _description.Text = message;

            AcceptButton = _okButton;
            CancelButton = _okButton;

            EventHandler okClick = delegate
            {
                Result = ExceptionDialogAction.Ok;
                ok();
            };

            EventHandler quitClick = delegate
            {
                Result = ExceptionDialogAction.Quit;
                quit();
            };

            if (buttonActions == ExceptionDialogActions.Ok)
            {
                if (ok == null)
                {
                    throw new ArgumentException("Ok method must be supplied", "ok");
                }

                _okButton.Click += okClick;
                _quitButton.Dispose();
            }
            else if (buttonActions == ExceptionDialogActions.Quit)
            {
                if (quit == null)
                {
                    throw new ArgumentException("Quit method must be supplied", "quit");
                }

                _quitButton.Click += quitClick;
                AcceptButton       = _quitButton;
                CancelButton       = _quitButton;
                _okButton.Dispose();
            }
            else
            {
                if (ok == null)
                {
                    throw new ArgumentException("Ok method must be supplied", "ok");
                }
                if (quit == null)
                {
                    throw new ArgumentException("Quit method must be supplied", "quit");
                }

                _okButton.Click   += okClick;
                _okButton.Text     = SR.MenuContinue;
                _quitButton.Click += quitClick;
            }

            if (_exception != null)
            {
                // Update Exceptions detail tree
                _detailTree.BeginUpdate();
                BuildTreeFromException(null, _exception);
                _detailTree.ExpandAll();
                _detailTree.EndUpdate();
            }
            else
            {
                _detailButton.Dispose();
            }

            // Hide the details when dialog first startup
            HideDetails();
        }
 internal static void Show(string message, Exception e, ExceptionDialogActions actions)
 {
     Show(Application.Name, message, e, actions);
 }
		internal ExceptionDialogControl(Exception exception, string message, ExceptionDialogActions buttonActions, ClickHandlerDelegate ok, ClickHandlerDelegate quit)
		{
			const string errorOk = "Ok method must be supplied";
			const string errorQuit = "Quit method must be supplied";

			_exception = exception;

			InitializeComponent();

			_description.Text = message;

			AcceptButton = _okButton;
			CancelButton = _okButton;

			EventHandler okClick = delegate
			                       	{
			                       		Result = ExceptionDialogAction.Ok;
			                       		ok();
			                       	};

			EventHandler quitClick = delegate
			                         	{
			                         		Result = ExceptionDialogAction.Quit;
			                         		quit();
			                         	};

			if (buttonActions == ExceptionDialogActions.Ok)
			{
				if (ok == null)
					throw new ArgumentException(errorOk, "ok");

				_okButton.Click += okClick;
				_quitButton.Dispose();
			}
			else
			{
				if (buttonActions == ExceptionDialogActions.Quit)
				{
					if (quit == null)
						throw new ArgumentException(errorQuit, "quit");

					_quitButton.Click += quitClick;
					AcceptButton = _quitButton;
					CancelButton = _quitButton;
					_okButton.Dispose();
				}
				else
				{
					if (ok == null)
						throw new ArgumentException(errorOk, "ok");
					if (quit == null)
						throw new ArgumentException(errorQuit, "quit");

					_okButton.Click += okClick;
					_okButton.Text = SR.MenuContinue;
					_quitButton.Click += quitClick;
				}
			}

			if (_exception != null)
			{
				// Update Exceptions detail tree
				_detailTree.BeginUpdate();
				BuildTreeFromException(null, _exception);
				_detailTree.ExpandAll();
				_detailTree.EndUpdate();
			}
			else
			{
				_detailButton.Dispose();
			}

			// Hide the details when dialog first startup
			HideDetails();
		}
Пример #6
0
 internal static void Show([param: Localizable(true)] string message, Exception e, ExceptionDialogActions actions)
 {
     Show(Application.Name, message, e, actions);
 }