static void Main() { //程序只能运行一次实例 Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Process instance = RunningInstance(); //全局服务端只准运行一个实例 if (Settings.IsOneServer == "one") { if (instance != null) { HandleRunningInstance(instance); Application.Exit(); return; } } else { killPerProcess(); } reg: //RegistryKey rk = Registry.Users.CreateSubKey(".DEFAULT\\Software\\Itopsoft\\sbxj"); //if (rk.GetValue("regkey") == null) //{ // frmReg fg = new frmReg(); // fg.ShowDialog(); //} //if (rk.GetValue("regkey") != null) //{ // if (VerifyRCode("sbxj2007", rk.GetValue("regkey").ToString()) == 0) // { // frmReg fg = new frmReg(); // fg.ShowDialog(); // } //} if (!Regstate()) { frmReg fg = new frmReg(); fg.ShowDialog(); return; } try { //把外部程序集加载到当前程序域中 //Assembly.LoadFile(Application.StartupPath+"\\Itop.Domain.Ex.dll"); LoadAssembly(); } catch (Exception e) { MessageBox.Show(e.Message); } Log = Log4NetLoggerFactory.CreateLogger <FrmServerManager>("ItopServer"); Log.Info("***************应用程序服务器准备启动****************"); try { Application.Run(new FrmServerManager()); } catch (Exception ex) { Log.Error(string.Format("系统出现意外的错误\n\n错误信息:{0}", ex.Message)); MessageBox.Show(string.Format("系统出现意外的错误\n\n错误信息:{0}", ex.Message)); Application.Exit(); } }
static void Main() { //程序只能运行一次实例 Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Process instance = RunningInstance(); //全局服务端只准运行一个实例 if (Settings.IsOneServer == "one") { if (instance != null) { HandleRunningInstance(instance); Application.Exit(); return; } } else { killPerProcess(); } reg: //RegistryKey rk = Registry.Users.CreateSubKey(".DEFAULT\\Software\\Itopsoft\\sbxj"); //if (rk.GetValue("regkey") == null) //{ // frmReg fg = new frmReg(); // fg.ShowDialog(); //} //if (rk.GetValue("regkey") != null) //{ // if (VerifyRCode("sbxj2007", rk.GetValue("regkey").ToString()) == 0) // { // frmReg fg = new frmReg(); // fg.ShowDialog(); // } //} if (!Regstate()) { frmReg fg = new frmReg(); fg.ShowDialog(); return; } try { //把外部程序集加载到当前程序域中 //Assembly.LoadFile(Application.StartupPath+"\\Itop.Domain.Ex.dll"); LoadAssembly(); } catch (Exception e) { MessageBox.Show(e.Message); } Log = Log4NetLoggerFactory.CreateLogger<FrmServerManager>("ItopServer"); Log.Info("***************应用程序服务器准备启动****************"); try { Application.Run(new FrmServerManager()); } catch (Exception ex) { Log.Error(string.Format("系统出现意外的错误\n\n错误信息:{0}", ex.Message)); MessageBox.Show(string.Format("系统出现意外的错误\n\n错误信息:{0}", ex.Message)); Application.Exit(); } }