Esempio n. 1
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            var globalMutex = new GlobalMutex("PDFCreator-137a7751-1070-4db4-a407-83c1625762c7");

            globalMutex.Acquire();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            Thread.CurrentThread.Name = "ProgramThread";

            try
            {
                LoggingHelper.InitFileLogger("PDFCreator", LoggingLevel.Error);

                RunApplication(e.Args);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "There was an error while starting PDFCreator");

                ErrorAssistant.ShowErrorWindowInNewProcess(ex);
            }
            finally
            {
                globalMutex.Release();
                Logger.Debug("Ending PDFCreator");
                Shutdown();
            }
        }
Esempio n. 2
0
        void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var ex = (Exception)e.ExceptionObject;

            Logger.Fatal(ex, "Uncaught exception, IsTerminating: {0}", e.IsTerminating);
            ErrorAssistant.ShowErrorWindowInNewProcess(ex);
        }