Inheritance: System.Windows.Forms.Form
Example #1
0
        private static void RunApplication(string[] args)
        {
#if !DEBUG
            try
            {
#endif
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

				string filePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
				Directory.SetCurrentDirectory(Path.GetDirectoryName(filePath));

#if BIBLE_EDITION
                Application.Run(new SelectReligion());
                // Need to re-add these because the end of Application.Run removes them
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
#endif

                SplashScreen splash = new SplashScreen();
                splash.Size = splash.BackgroundImage.Size;
                splash.Load += new EventHandler(splash_Load);
                Application.Run(splash);

                // Need to re-add these because the end of Application.Run removes them
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                _application.StartGUI(args);
#if !DEBUG
            }
            catch (Exception ex)
            {
                MessageBox.Show("An unexpected error occurred. See below for details." + Environment.NewLine + ex.ToString(), "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
#endif
        }