static void Main() { //Application.ProductVersion.ToString() + "\n"; //System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (!CheckAppRunState()) { return; } LocalLogin localLogin = new LocalLogin(); localLogin.ShowDialog(); if (localLogin.DialogResult == DialogResult.OK) { var programeVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "\n"; //WelcomeForm welcomeForm = new WelcomeForm(DeviceConfigParams.CableTestSystemName,programeVersion); //welcomeForm.Show(); //applicationContext = new ApplicationContext(); //applicationContext.Tag = welcomeForm; //Application.Idle += Application_Idle; //Application.Run(applicationContext); CMainForm cMainForm = new CMainForm(); cMainForm.Init(); Application.Run(cMainForm); } }
private static void Application_Idle(object sender, EventArgs e) { Application.Idle -= new EventHandler(Application_Idle); if (applicationContext.MainForm == null) { CMainForm cMainForm = new CMainForm(); applicationContext.MainForm = cMainForm; //init cMainForm.Init(); WelcomeForm welcomeForm = applicationContext.Tag as WelcomeForm; welcomeForm.Close(); cMainForm.Show(); } }