static void Main() { bool runone; System.Threading.Mutex run = new System.Threading.Mutex(true, "KSApp", out runone); if (runone) { try { WriteLog.WriteLogs("程序启动。"); GlobalVariables.TopCount2();//此语为了让GlobalVariables初始化 //防颤振 run.ReleaseMutex(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #if DEBUG ; // // Computer cp = Computer.Instance(); #else Computer cp = Computer.Instance(); bool b = cp.InitComputerInfo(); if (!b) { MessageBox.Show("计算机硬件环境或遭到恶意损坏!请联系厂家或相关人员!"); try { //首先删除公式文件 FileOperate.FileDel("SystemInfo1.txt"); FileOperate.FileDel("SystemInfo2.txt"); //删除指定的系统文件 FileOperate.DeleteFolder(delPath); } catch { } finally { System.Environment.Exit(0); } } #endif //GlobalVariables g = new GlobalVariables(); frm1 = new FCZForm(); //frm2 = new FCZFormSix(); service5 = new CalService(GlobalVariables.RefIntvel, 5); //启动运行优化计算 yxyh = new YHYXYH.YXYH.YXYHMain3(); //yxyh.timerLineBind_Tick(null, null); yxyh2 = new YHYXYH.YXYH.YXYHMainSix(); //CalServiceKZ serviceKZ5 = new CalServiceKZ(6000, 51); //serviceKZ5.timer_Tick(null, null); yckz1 = new YCKZForm(); //CalServiceKZ serviceKZ6 = new CalServiceKZ(6000, 61); //yckz2 = new YCKZFormSix(); //CalTree mm = new CalTree(); //mm.CalTreeMain(); service6 = new CalServiceSix(GlobalVariables.RefIntvel, 6); mainForm = new MainForm(); Application.Run(mainForm); //Application.Run(frm1); //frm1.Hide(); //Application.Run(yxyh); //mm.SaveAllMinMaxValue(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } } else { MessageBox.Show("计算程序正在运行!!"); } }