private void GlControl1_Load(object sender, EventArgs e)
        {
            try
            {
                effects.LoadResources();

                imuModel.LoadResources();
                axisModel.LoadResources();
                floorTileModel.LoadResources();
                tileTexture.LoadResources();

                textRenderer.LoadResources();
                texturedQuad.LoadResources();

                //lightBuffer.LoadResources();
            }
            catch (Exception ex)
            {
                using (ExceptionDialog dialog = new ExceptionDialog())
                {
                    dialog.Title = "An Exception Occurred During Load Resources";

                    dialog.Label  = ex.Message;
                    dialog.Detail = ex.ToString();

                    dialog.ShowDialog(this);
                }

                isInErrorState = true;
            }
        }
        void listViewExpressions_ItemActivate(object sender, EventArgs e)
        {
            try
            {
                if (this.listView.SelectedItems.Count < 1)
                {
                    return;
                }

                ListViewItem item = this.listView.SelectedItems[0];

                Error error = item.Tag as Error;
                if (error == null)
                {
                    return;
                }

                this.ErrorActivated(this, new EventArgs <Error>(error));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                ExceptionDialog.ShowDialog(this, ex);
            }
        }
Example #3
0
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

#if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                Exception exception = (Exception)args.ExceptionObject;

                ExceptionDialog formException = new ExceptionDialog("An unrecoverable problem has occurred!", exception);
                formException.ShowDialog();

                if (args.IsTerminating)
                {
                    Application.Exit();
                }
            };

            if (Process.GetProcessesByName("Cube").Length > 0)
            {
                MessageBox.Show("Please close Cube World before running the Character Editor.", "Character Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
#endif

            Application.Run(new Editor());
        }
Example #4
0
        private void OnListViewExpressionsAfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            try
            {
                if (e.CancelEdit || e.Label == null)
                {
                    return;
                }

                XPathExpressionListViewItem item = this.listViewExpressions.Items[e.Item] as XPathExpressionListViewItem;

                if (item == null)
                {
                    return;
                }

                item.XPathExpression.Name = e.Label;

                item.Text = e.Label;

                this.listViewExpressions.AutoResizeColumns();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                ExceptionDialog.ShowDialog(this, ex);
            }
        }
Example #5
0
        private void OnListViewExpressionsKeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (this.listViewExpressions.SelectedItems.Count < 1)
                {
                    return;
                }

                XPathExpressionListViewItem item = this.listViewExpressions.SelectedItems[0] as XPathExpressionListViewItem;

                if (item == null)
                {
                    return;
                }

                switch (e.KeyCode)
                {
                case Keys.Delete:
                    this.DeleteSelectedExpressionItems(e.Shift);
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                ExceptionDialog.ShowDialog(this, ex);
            }
        }
Example #6
0
        public static DialogResult ShowCrashLogDialog(string crashLogPath)
        {
            object sync = CrashManager.sync;

            lock (sync)
            {
                alreadyReported = true;
            }
            string directoryName = Path.GetDirectoryName(crashLogPath);
            string crashLogText  = File.ReadAllText(crashLogPath);

            using (ExceptionDialog dialog = new ExceptionDialog())
            {
                dialog.Text              = PdnResources.GetString("CrashLogDialog.Title.Text");
                dialog.Message           = PdnResources.GetString("CrashLogDialog.Message");
                dialog.Message2          = GetSecondParagraphForMessage(crashLogText);
                dialog.Button1Text       = PdnResources.GetString("CrashLogDialog.RestartButton.Text");
                dialog.IsButton1Visible  = true;
                dialog.Button2Text       = PdnResources.GetString("CrashLogDialog.QuitButton.Text");
                dialog.ExceptionText     = crashLogText;
                dialog.CrashLogDirectory = directoryName;
                dialog.ShowInTaskbar     = true;
                return(dialog.ShowDialog());
            }
        }
Example #7
0
        public override DialogResult ShowDialog(IWin32Window owner, Exception exception, bool mustTerminate)
        {
            Exception     = exception ?? throw new ArgumentNullException(nameof(exception));
            MustTerminate = mustTerminate;

            Dialog = new ExceptionDialog(this);
            return(Dialog.ShowDialog(owner));
        }
Example #8
0
        //Exception Logging for the application
        public static void LogException(Exception ex, SpecificationBase spec)
        {
            ExceptionDialog log = new ExceptionDialog(ex, APPLICATION_NAME, spec);

            log.ShowDialog();
            if (Common.Utility.Utilities.IsWindowsOS)
            {
                FlashWindowEx(log);
            }
        }
Example #9
0
 private void toolStripButtonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         this.DeleteSelectedExpressions();
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(this, ex);
     }
 }
        private void DisplayException_Inner(string label, string detail)
        {
            using (ExceptionDialog dialog = new ExceptionDialog())
            {
                dialog.Title = "An Exception Occurred";

                dialog.Label  = label;
                dialog.Detail = detail;

                dialog.ShowDialog(this);
            }
        }
Example #11
0
 private void toolStripButtonEditExpressions_Click(object sender, EventArgs e)
 {
     try
     {
         CollectionEditor.EditValue(this, this, "Expressions");
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(this, ex);
     }
 }
Example #12
0
    public static bool Ok(Exception exception, string title, string instruction, string observation = "", bool bugWith4055002 = false)
    {
        var dialog = new ExceptionDialog(exception)
        {
            BugWithHotFix4055002 = bugWith4055002
        };

        dialog.PrepareOk(title, instruction, observation);
        var result = dialog.ShowDialog();

        return(result.HasValue && result.Value);
    }
 private void XmlSchemaLink_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Process.Start("http://www.w3schools.com/Schema");
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(ex);
     }
 }
Example #14
0
 private void OnToolStripSpringTextBoxFilterTextChanged(object sender, EventArgs e)
 {
     try
     {
         this.UpdateExpressionFilter(this.toolStripSpringTextBoxFilter.Text);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(this, ex);
     }
 }
Example #15
0
 private void buttonCancel_Click(object sender, EventArgs e)
 {
     try
     {
         this.DialogResult = DialogResult.Cancel;
         this.Close();
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(this, ex);
     }
 }
Example #16
0
        void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            ExceptionDialog dialog = new ExceptionDialog(e);

            if (MainWindow != null && MainWindow.IsVisible)
            {
                dialog.Owner = MainWindow;
            }

            dialog.ShowDialog();

            e.Handled = true;
        }
 private static void On_UnhandledException(object sender, UnhandledExceptionEventArgs ex_arg)
 {
     if (ex_arg.ExceptionObject is ThreadAbortException)
     {
         return;
     }
     //Display the exception message box on another thread
     _thread = new Thread(new ParameterizedThreadStart((ex) =>
                                                       ExceptionDialog.ShowDialog((Exception)ex)
                                                       ));
     _thread.IsBackground = true;
     SysWaiter.Signal();
     _thread.Start(ex_arg.ExceptionObject);
 }
 void header_BrowseClicked(object sender, EventArgs e)
 {
     try
     {
         if (this.BrowseClicked != null)
         {
             this.BrowseClicked(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(this, ex);
     }
 }
Example #19
0
 private void OnListViewExpressionsItemActivate(object sender, EventArgs e)
 {
     try
     {
         if (this.ExpressionsActivated != null)
         {
             this.ExpressionsActivated(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(this, ex);
     }
 }
Example #20
0
        public static void ShowException(Exception ex)
        {
            if (ex == null)
            {
                return;
            }

            using (var d = new ExceptionDialog())
            {
                d.Message          = ex.Message;
                d.Exception        = ex;
                d.ShowErrorDetails = true;
                d.ShowDialog();
            }
        }
 private void HyperlinkBrowse_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (this.BrowseClicked != null)
         {
             this.BrowseClicked(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(ex);
     }
 }
Example #22
0
 private void toolStripButtonLaunchXpath_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.ExpressionsLaunched != null)
         {
             this.ExpressionsLaunched(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(this, ex);
     }
 }
Example #23
0
 private void OnListViewExpressionsMouseUp(object sender, MouseEventArgs e)
 {
     try
     {
         if (this.SelectedExpressionChanged != null)
         {
             this.SelectedExpressionChanged(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(this, ex);
     }
 }
Example #24
0
        /// <summary>
        /// Notifies all components the debugger has paused.
        /// </summary>
        /// <param name="e">The event arguments to use.</param>
        public void DispatchPaused(ControllerPauseEventArgs e)
        {
            if (Paused != null)
            {
                Paused(null, e);
            }
            CurrentFrame = e.Thread.CurrentFrame;

            if (e.Reason == PauseReason.Exception)
            {
                using (var dialog = new ExceptionDialog(e.Thread))
                {
                    dialog.ShowDialog();
                }
            }
        }
Example #25
0
        public void Except()
        {
            Application.EnableVisualStyles();

            try
            {
                throw new Exception("Foo Exception",
                                    new Exception("InnerFoo Exception"));
            }
            catch (Exception exc)
            {
                Application.EnableVisualStyles();
                ExceptionDialog dialog = new ExceptionDialog(exc);
                dialog.ShowDialog();
            }
        }
Example #26
0
        /// <summary>
        /// Handles an unhandled exception.
        /// </summary>
        /// <param name="ex">The ex.</param>
        public static void UnhandledException(Exception ex)
        {
            _timeStamp = DateTime.Now;

            using (ExceptionDialog dialog = new ExceptionDialog(ex))
            {
                dialog.SubmitError += new EventHandler <ExceptionDetailEventArgs>(messageBox_SubmitError);
                dialog.UserName     = UserManager.CurrentUserName.ToUpperInvariant();

                DialogResult result = dialog.ShowDialog(_mainForm);
                if (result == DialogResult.Abort)
                {
                    Application.Exit();
                }
            }
        }
 protected override void OnMouseUp(MouseEventArgs e)
 {
     try
     {
         base.OnMouseUp(e);
         if (e.Button == MouseButtons.Middle)
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ExceptionDialog.ShowDialog(this, ex);
     }
 }
        /// <summary>
        /// Occurs when attempting to start a single-instance application and the application is already active.
        /// </summary>
        private static void OnStartupNextInstance(object sender, StartupNextInstanceEventArgs e)
        {
            // an attempt to start the application a second time has been made
            try
            {
                // handle any command-line args
                SingleInstanceApplication.Instance.MainWindow.Open(e.CommandLine);

                e.BringToForeground = true;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                ExceptionDialog.ShowDialog(ex);
            }
        }
Example #29
0
        void OnLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                LinkLabel label = sender as LinkLabel;
                if (label == null)
                {
                    return;
                }

                Process.Start(label.Text);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                ExceptionDialog.ShowDialog(this, ex);
            }
        }
Example #30
0
        /// <summary>
        /// Handles an unhandled exception.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="detail">The detail.</param>
        /// <param name="userName">Name of the user.</param>
        public static void UnhandledException(string message, string detail, string userName = null)
        {
            _timeStamp = DateTime.Now;

            using (ExceptionDialog dialog = new ExceptionDialog(message, detail))
            {
                dialog.SubmitError += new EventHandler <ExceptionDetailEventArgs>(messageBox_SubmitError);
                if (!string.IsNullOrEmpty(userName))
                {
                    dialog.UserName = userName;
                }

                DialogResult result = dialog.ShowDialog();
                if (result == DialogResult.Abort)
                {
                    Application.Exit();
                }
            }
        }
        /// <summary>
        /// Shows the exception dialog.
        /// </summary>
        private void ShowExceptionDialog()
        {
            if (this.listErrors.SelectedItems.Count > 0)
            {
                TestError testError = listErrors.SelectedItems[0].Tag as TestError;

                if (testError != null)
                {
                    ExceptionDialog exceptionDialog = new ExceptionDialog(testError);
                    exceptionDialog.ShowDialog(this);
                }
            }
        }
        private static DialogResult ShowDialogInternal(string strWhatHappened, string strHowUserAffected, string strWhatUserCanDo, string strMoreDetails, MessageBoxButtons Buttons, MessageBoxIcon Icon, UserErrorDefaultButton DefaultButton)
        {
            ProcessStrings(ref strWhatHappened, ref strHowUserAffected, ref strWhatUserCanDo, ref strMoreDetails);

            var objForm = new ExceptionDialog();
            
            objForm.Text = ReplaceStringVals(objForm.Text);
            objForm.ErrorBox.Text = strWhatHappened;
            objForm.ScopeBox.Text = strHowUserAffected;
            objForm.ActionBox.Text = strWhatUserCanDo;
            objForm.txtMore.Text = strMoreDetails;

            switch (((int) Buttons))
            {
                case 0:
                    objForm.btn3.Text = "OK";
                    objForm.btn2.Visible = false;
                    objForm.btn1.Visible = false;
                    objForm.AcceptButton = objForm.btn3;
                    break;

                case 1:
                    objForm.btn3.Text = "Cancel";
                    objForm.btn2.Text = "OK";
                    objForm.btn1.Visible = false;
                    objForm.AcceptButton = objForm.btn2;
                    objForm.CancelButton = objForm.btn3;
                    break;

                case 2:
                    objForm.btn1.Text = "&Abort";
                    objForm.btn2.Text = "&Retry";
                    objForm.btn3.Text = "&Ignore";
                    objForm.AcceptButton = objForm.btn2;
                    objForm.CancelButton = objForm.btn3;
                    break;

                case 3:
                    objForm.btn3.Text = "Cancel";
                    objForm.btn2.Text = "&No";
                    objForm.btn1.Text = "&Yes";
                    objForm.CancelButton = objForm.btn3;
                    break;

                case 4:
                    objForm.btn3.Text = "&No";
                    objForm.btn2.Text = "&Yes";
                    objForm.btn1.Visible = false;
                    break;

                case 5:
                    objForm.btn3.Text = "Cancel";
                    objForm.btn2.Text = "&Retry";
                    objForm.btn1.Visible = false;
                    objForm.AcceptButton = objForm.btn2;
                    objForm.CancelButton = objForm.btn3;
                    break;
            }

            if (Icon == MessageBoxIcon.Hand)
            {
                objForm.PictureBox1.Image = SystemIcons.Error.ToBitmap();
            }
            else if (Icon == MessageBoxIcon.Hand)
            {
                objForm.PictureBox1.Image = SystemIcons.Error.ToBitmap();
            }
            else if (Icon == MessageBoxIcon.Exclamation)
            {
                objForm.PictureBox1.Image = SystemIcons.Exclamation.ToBitmap();
            }
            else if (Icon == MessageBoxIcon.Asterisk)
            {
                objForm.PictureBox1.Image = SystemIcons.Information.ToBitmap();
            }
            else if (Icon == MessageBoxIcon.Question)
            {
                objForm.PictureBox1.Image = SystemIcons.Question.ToBitmap();
            }
            else
            {
                objForm.PictureBox1.Image = SystemIcons.Error.ToBitmap();
            }
            
            switch (((int) DefaultButton))
            {
                case 1:
                    objForm.AcceptButton = objForm.btn1;
                    objForm.btn1.TabIndex = 0;
                    break;

                case 2:
                    objForm.AcceptButton = objForm.btn2;
                    objForm.btn2.TabIndex = 0;
                    break;

                case 3:
                    objForm.AcceptButton = objForm.btn3;
                    objForm.btn3.TabIndex = 0;
                    break;
            }

            return objForm.ShowDialog();
        }
Example #33
0
        //--
        //-- internal method to show error dialog
        //--
        private static DialogResult ShowDialogInternal(string strWhatHappened, string strHowUserAffected, string strWhatUserCanDo, string strMoreDetails, MessageBoxButtons Buttons, MessageBoxIcon Icon, UserErrorDefaultButton DefaultButton)
        {
            //-- set default values, etc
            ProcessStrings(ref strWhatHappened, ref strHowUserAffected, ref strWhatUserCanDo, ref strMoreDetails);

            ExceptionDialog objForm = new ExceptionDialog();
            var _with3 = objForm;
            _with3.Text = ReplaceStringVals(objForm.Text);
            _with3.ErrorBox.Text = strWhatHappened;
            _with3.ScopeBox.Text = strHowUserAffected;
            _with3.ActionBox.Text = strWhatUserCanDo;
            _with3.txtMore.Text = strMoreDetails;

            //-- determine what button text, visibility, and defaults are
            var _with4 = objForm;
            switch (Buttons)
            {
                case MessageBoxButtons.AbortRetryIgnore:
                    _with4.btn1.Text = "&Abort";
                    _with4.btn2.Text = "&Retry";
                    _with4.btn3.Text = "&Ignore";
                    _with4.AcceptButton = objForm.btn2;
                    _with4.CancelButton = objForm.btn3;
                    break;
                case MessageBoxButtons.OK:
                    _with4.btn3.Text = "OK";
                    _with4.btn2.Visible = false;
                    _with4.btn1.Visible = false;
                    _with4.AcceptButton = objForm.btn3;
                    break;
                case MessageBoxButtons.OKCancel:
                    _with4.btn3.Text = "Cancel";
                    _with4.btn2.Text = "OK";
                    _with4.btn1.Visible = false;
                    _with4.AcceptButton = objForm.btn2;
                    _with4.CancelButton = objForm.btn3;
                    break;
                case MessageBoxButtons.RetryCancel:
                    _with4.btn3.Text = "Cancel";
                    _with4.btn2.Text = "&Retry";
                    _with4.btn1.Visible = false;
                    _with4.AcceptButton = objForm.btn2;
                    _with4.CancelButton = objForm.btn3;
                    break;
                case MessageBoxButtons.YesNo:
                    _with4.btn3.Text = "&No";
                    _with4.btn2.Text = "&Yes";
                    _with4.btn1.Visible = false;
                    break;
                case MessageBoxButtons.YesNoCancel:
                    _with4.btn3.Text = "Cancel";
                    _with4.btn2.Text = "&No";
                    _with4.btn1.Text = "&Yes";
                    _with4.CancelButton = objForm.btn3;
                    break;
            }

            ////-- set the proper dialog icon
            //switch (Icon) {
            //    case MessageBoxIcon.Error:
            //        objForm.PictureBox1.Image = System.Drawing.SystemIcons.Error.ToBitmap();
            //        break;
            //    case MessageBoxIcon.Stop:
            //        objForm.PictureBox1.Image = System.Drawing.SystemIcons.Error.ToBitmap();
            //        break;
            //    case MessageBoxIcon.Exclamation:
            //        objForm.PictureBox1.Image = System.Drawing.SystemIcons.Exclamation.ToBitmap();
            //        break;
            //    case MessageBoxIcon.Information:
            //        objForm.PictureBox1.Image = System.Drawing.SystemIcons.Information.ToBitmap();
            //        break;
            //    case MessageBoxIcon.Question:
            //        objForm.PictureBox1.Image = System.Drawing.SystemIcons.Question.ToBitmap();
            //        break;
            //    default:
            //        objForm.PictureBox1.Image = System.Drawing.SystemIcons.Error.ToBitmap();
            //        break;
            //}

            //'-- set the proper dialog icon
            MessageBoxIcon PictureBox1 = Icon;
            if (PictureBox1 == MessageBoxIcon.Hand)
            {
                objForm.PictureBox1.Image = SystemIcons.Error.ToBitmap();
            }
            else if (PictureBox1 == MessageBoxIcon.Hand)
            {
                objForm.PictureBox1.Image = SystemIcons.Error.ToBitmap();
            }
            else if (PictureBox1 == MessageBoxIcon.Exclamation)
            {
                objForm.PictureBox1.Image = SystemIcons.Exclamation.ToBitmap();
            }
            else if (PictureBox1 == MessageBoxIcon.Asterisk)
            {
                objForm.PictureBox1.Image = SystemIcons.Information.ToBitmap();
            }
            else if (PictureBox1 == MessageBoxIcon.Question)
            {
                objForm.PictureBox1.Image = SystemIcons.Question.ToBitmap();
            }
            else
            {
                objForm.PictureBox1.Image = SystemIcons.Error.ToBitmap();
            }

            //-- override the default button
            switch (DefaultButton)
            {
                case UserErrorDefaultButton.Button1:
                    objForm.AcceptButton = objForm.btn1;
                    objForm.btn1.TabIndex = 0;
                    break;
                case UserErrorDefaultButton.Button2:
                    objForm.AcceptButton = objForm.btn2;
                    objForm.btn2.TabIndex = 0;
                    break;
                case UserErrorDefaultButton.Button3:
                    objForm.AcceptButton = objForm.btn3;
                    objForm.btn3.TabIndex = 0;
                    break;
            }

            if (_blnEmailError)
            {
                SendNotificationEmail(strWhatHappened, strHowUserAffected, strWhatUserCanDo, strMoreDetails);
            }

            //-- show the user our error dialog
            return objForm.ShowDialog();
        }