static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new frmLogin()); try { //处理未捕获的异常 Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); //处理UI线程异常 Application.ThreadException += Application_ThreadException; //处理非UI线程异常 AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.ApplicationExit += CheckSynInstockToStockCompleted; var aProcessName = Process.GetCurrentProcess().ProcessName; if ((Process.GetProcessesByName(aProcessName)).GetUpperBound(0) > 0) { MessageBox.Show(@"系统已经在运行中,如果要重新启动,请从进程中关闭...", @"系统警告", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var sp = new frmLogin(); //create splash screen sp.Show(); //show splash screen context = new ApplicationContext(); context.Tag = sp; //Application.Idle += Application_Idle; //注册程序运行空闲去执行主程序窗体相应初始化代码 Application.Run(context); } } catch (Exception ex) { var tt = ""; // LogHelper.Log(ex); //MessageBox.Show("系统出现未知异常,请重启系统!"); } }
private void mmu_about_Click(object sender, EventArgs e) { this.Hide(); frmLogin frmLogin = new frmLogin(); frmLogin.Show(); }