Exemplo n.º 1
0
        /// <summary>
        /// Handles an exception through the Unhandled Exception window
        /// </summary>
        /// <param name="ex">Exception to display</param>
        private static void HandleUnhandledException(Exception ex)
        {
            if (!Debugger.IsAttached)
            {
                if (s_showWindowOnError)
                {
                    s_showWindowOnError = false;

                    // Shutdown EveClient timer incase that was causing the crash
                    // so we don't get multiple crashes
                    try
                    {
                        EveClient.Shutdown();
                        using (UnhandledExceptionWindow f = new UnhandledExceptionWindow(ex))
                        {
                            f.ShowDialog(s_mainWindow);
                        }
                    }
                    catch
                    {
                        StringBuilder MessageBuilder = new StringBuilder();
                        MessageBuilder.AppendLine("An error occured and EVEMon was unable to handle the error message gracefully");
                        MessageBuilder.AppendLine();
                        MessageBuilder.AppendFormat("The exception encountered was '{0}'.", ex.Message);
                        MessageBuilder.AppendLine();
                        MessageBuilder.AppendLine();
                        MessageBuilder.AppendLine("Please report this on the EVEMon forums.");
                        MessageBox.Show(MessageBuilder.ToString(), "EVEMon Error Occured", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    Environment.Exit(1);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles an exception through the Unhandled Exception window.
        /// </summary>
        /// <param name="ex">Exception to display</param>
        private static void HandleUnhandledException(Exception ex)
        {
            if (Debugger.IsAttached)
            {
                return;
            }

            if (s_errorWindowIsShown)
            {
                return;
            }

            s_errorWindowIsShown = true;

            try
            {
                // Some exceptions may be thrown on a worker thread so we need to invoke them to the UI thread,
                // if we are already on the UI thread nothing changes
                if (s_mainWindow != null && s_mainWindow.InvokeRequired)
                {
                    Dispatcher.Invoke(() => HandleUnhandledException(ex));
                    return;
                }

                using (UnhandledExceptionWindow form = new UnhandledExceptionWindow(ex))
                {
                    if (s_mainWindow != null && !s_mainWindow.IsDisposed)
                    {
                        form.ShowDialog(s_mainWindow);
                    }
                    else
                    {
                        form.ShowDialog();
                    }
                }

                // Notify Gooogle Analytics about ending via the Unhandled Exception window
                GAnalyticsTracker.TrackEnd(typeof(Program));
            }
            catch (Exception e)
            {
                StringBuilder messageBuilder = new StringBuilder();
                messageBuilder.AppendLine(string.Format(Properties.Resources.ErrorUnhandled,
                                                        e.Message));
                if (ex.GetBaseException().Message != e.Message)
                {
                    messageBuilder.AppendLine(string.Format(Properties.Resources.
                                                            ErrorUnhandledBase, ex.GetBaseException().Message));
                }
                messageBuilder.AppendLine(Properties.Resources.ErrorUnhandledEnd);
                if (EveMonClient.IsDebugBuild)
                {
                    messageBuilder.AppendLine().AppendLine(UnhandledExceptionWindow.
                                                           GetRecursiveStackTrace(ex));
                }
                MessageBox.Show(messageBuilder.ToString(), @"EVEMon Error", MessageBoxButtons.
                                OK, MessageBoxIcon.Error);
            }

            Environment.Exit(1);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles an exception through the Unhandled Exception window.
        /// </summary>
        /// <param name="ex">Exception to display</param>
        private static void HandleUnhandledException(Exception ex)
        {
            if (Debugger.IsAttached)
            {
                return;
            }

            if (s_errorWindowIsShown)
            {
                return;
            }

            s_errorWindowIsShown = true;

            try
            {
                // Some exceptions may be thrown on a worker thread so we need to invoke them to the UI thread,
                // if we are already on the UI thread nothing changes
                if (s_mainWindow != null && s_mainWindow.InvokeRequired)
                {
                    Dispatcher.Invoke(() => HandleUnhandledException(ex));
                    return;
                }

                using (UnhandledExceptionWindow form = new UnhandledExceptionWindow(ex))
                {
                    if (s_mainWindow != null && !s_mainWindow.IsDisposed)
                    {
                        form.ShowDialog(s_mainWindow);
                    }
                    else
                    {
                        form.ShowDialog();
                    }
                }

                // Notify Gooogle Analytics about ending via the Unhandled Exception window
                GAnalyticsTracker.TrackEnd(typeof(Program));
            }
            catch (Exception e)
            {
                StringBuilder messageBuilder = new StringBuilder();
                messageBuilder
                .AppendLine(@"An error occurred and EVEMon was unable to handle the error message gracefully.")
                .AppendLine()
                .AppendLine($"The exception encountered was '{e.Message}'.");

                if (ex.GetBaseException().Message != e.Message)
                {
                    messageBuilder
                    .AppendLine()
                    .AppendLine($"The original exception encountered was '{ex.GetBaseException().Message}'.");
                }

                messageBuilder
                .AppendLine()
                .AppendLine(@"Please report this on the EVEMon forums.");

                if (EveMonClient.IsDebugBuild)
                {
                    messageBuilder.AppendLine().AppendLine(UnhandledExceptionWindow.GetRecursiveStackTrace(ex));
                }

                MessageBox.Show(messageBuilder.ToString(), @"EVEMon Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }

            Environment.Exit(1);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handles an exception through the Unhandled Exception window
        /// </summary>
        /// <param name="ex">Exception to display</param>
        private static void HandleUnhandledException(Exception ex)
        {
            if (!Debugger.IsAttached)
            {
                if (s_showWindowOnError)
                {
                    s_showWindowOnError = false;

                    // Shutdown EveClient timer incase that was causing the crash
                    // so we don't get multiple crashes
                    try
                    {
                        EveClient.Shutdown();
                        using (UnhandledExceptionWindow f = new UnhandledExceptionWindow(ex))
                        {
                            f.ShowDialog(s_mainWindow);
                        }
                    }
                    catch
                    {
                        StringBuilder MessageBuilder = new StringBuilder();
                        MessageBuilder.AppendLine("An error occurred and EVEMon was unable to handle the error message gracefully");
                        MessageBuilder.AppendLine();
                        MessageBuilder.AppendFormat(CultureConstants.DefaultCulture, "The exception encountered was '{0}'.", ex.Message);
                        MessageBuilder.AppendLine();
                        MessageBuilder.AppendLine();
                        MessageBuilder.AppendLine("Please report this on the EVEMon forums.");
                        MessageBox.Show(MessageBuilder.ToString(), "EVEMon Error Occurred", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    Environment.Exit(1);
                }
            }
        }