Пример #1
0
        public static void Handle(object exception)
        {
            if (exception is DllNotFoundException)
            {
                MessageBox.Show("A required library is missing that OSIRT needs. Please ensure that OSIRT is running within the extracted folder. See the 'Running OSIRT' section in the user guide.", "Missing Library", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Application.Exit();
                return;
            }
            else if (exception is MissingMethodException)
            {
                MessageBox.Show("You require the .NET Framework 4.6 or later. Please see the 'System Requirements' section of the user guide to install the correct version of the .NET framework ", "Old version of the .NET framework installed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                // Application.Exit();
                return;
            }
            //else if(exception is ImageMagick.MagickDelegateErrorException)
            //{
            //    MessageBox.Show("There has been an error combining the screenshot (MagickDelegateErrorException). Try taking the screenshot again.", "Error combining screenshot" ,MessageBoxButtons.OK, MessageBoxIcon.Error);

            //    // Application.Exit();
            //    return;
            //}


            using (UnhandledExceptionForm exceptionFrom = new UnhandledExceptionForm(exception.ToString()))
            {
                if (DialogResult.OK == exceptionFrom.ShowDialog())
                {
                    new CaseCleanUpLogic("", false);
                    Application.Exit();
                }
            }
        }
Пример #2
0
        private static void HandleException(Exception ex)
        {
            LoggerInstance.Log(ex);

            var frm = new UnhandledExceptionForm();

            frm.Init(ex.ToString());
            frm.ShowDialog();

            Environment.Exit(1);
        }
Пример #3
0
        private static void HandleException(Exception ex)
        {
            LoggerInstance.Log(ex);

            var versionStr = "Version: " + Updates.Utilities.TryGetVersion();
            var res        = UnhandledExceptionForm.ShowModal(ex.ToString());

            if (res == UnhandledExceptionForm.FormDialogResult.Yes)
            {
                ReportError(versionStr + '\n' + ex.ToString());
            }

            Environment.Exit(1);
        }
Пример #4
0
 /// <summary>
 /// Power down on errors
 /// </summary>
 private void OnErrorPowerDown(Exception exception)
 {
     try
     {
         if (RailwayState != null)
         {
             RailwayState.Power.Requested = false;
         }
         UnhandledExceptionForm.ShowExceptionDialog(exception);
     }
     catch (Exception ex)
     {
     }
 }
Пример #5
0
 private static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.ApplicationExit += Application_ApplicationExit;
     try {
         Run();
     } catch (Exception e) {
         using (var form = new UnhandledExceptionForm()) {
             if (options != null)
             {
                 form.Language = options.Language;
             }
             form.Email   = Settings.Default.Email;
             form.Message = e.ToString();
             form.Send   += (sender, args) => ErrorSender.Send(e);
             form.ShowDialog();
         }
     }
 }
Пример #6
0
        internal static void Main(string[] args)
        {
            // Create mutex
            appMutex = new Mutex(false, MUTEX_NAME);

            // Register exception handler
            UnhandledExceptionForm.Register();

            // Set locale
            var locale = UserPreferences.Preferences.Locale;

            if (!string.IsNullOrEmpty(locale))
            {
                var cultureInfo = CultureInfo.GetCultureInfo(locale);
                Thread.CurrentThread.CurrentUICulture = cultureInfo;
            }

            // Show main form
            var mainForm = new MainForm(args);

            Application.EnableVisualStyles();
            Application.Run(mainForm);
        }