コード例 #1
0
ファイル: Program.cs プロジェクト: MinhHuong/WSN-PN
        private static void Main(string[] files)
        {
            Application.SetCompatibleTextRenderingDefault(false);
            Application.EnableVisualStyles();
            Application.DoEvents();

            //if (Common.Ultility.Ultility.IsWindowsOS)
            //{
            //    // start the splash thread at the beginning
            //    var splashThread = new Thread(SplashScreen.SplashScreen.ShowSplashScreen) {IsBackground = true};
            //    splashThread.Start();
            //}

            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            try
            {
                SettingUtils.ReadSettingValue();
            }
            catch (Exception) { }

            FormMain mainForm;

            if (Common.Utility.Utilities.IsWindowsOS)
            {
                //// tell the user what we do here
                //SplashScreen.SplashScreen.UpdateStatusText("Update checked");

                mainForm = new FormMain();

                //// after load the main form, close the splashscreen
                //SplashScreen.SplashScreen.CloseSplashScreen();
            }
            else
            {
                mainForm = new FormMain();
            }

            try
            {
                if (files.Length > 0)
                {
                    mainForm.OpenFile(files[0], false);
                }
                else
                {
                    mainForm.OpenFileLastFile();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid File on arguments:" + ex.Message + ex.StackTrace);
            }

            Application.Run(mainForm);
        }