Esempio n. 1
0
        static void Main()
        {
            DbHelper.dbType = DataBaseType.SQLite;

            bool isAppRunning = false;

            System.Threading.Mutex mutex = new System.Threading.Mutex(
                true,
                System.Diagnostics.Process.GetCurrentProcess().ProcessName,
                out isAppRunning);
            if (!isAppRunning)
            {
                MessageBox.Show("本程序已经在运行了,请不要重复运行!");
                Environment.Exit(1);
            }
            else
            {
                try {
                    Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    frmSplashForm fromSplash = new frmSplashForm();
                    Application.Run(fromSplash);
                    if (fromSplash.IsShow)
                    {
                        #region 执行计划任务
                        PlanTaskHelper.InitScheduler();
                        PlanTaskHelper.LoadAllJobs();
                        #endregion

                        Application.Run(new frmMain());
                    }
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message + "::" + ex.InnerException + "::" + ex.StackTrace + "::" + ex.Source + "::" + ex.HelpLink);
                }
            }
        }