public static bool SystemExit(bool shutDown, bool isOk = true) { try { Globals.AppCfg.Shutdown = isOk; Globals.AppCfg.SaveDefaultSysConfigFile();//保存当前应用配置 if (X_Axis != null && X_Axis.Enabled) { X_Axis.AxisAotoEscapeLimit(); } if (Y_Axis != null && Y_Axis.Enabled) { Y_Axis.AxisAotoEscapeLimit(); } if (T_Axis != null && T_Axis.Enabled) { T_Axis.AxisAotoEscapeLimit(); } if (Z_Axis != null && Z_Axis.Enabled) { Z_Axis.AxisAotoEscapeLimit(); Z_Axis.AxisGoHomeWork(true); //Z轴回位操作 ReportCmdKeyProgress(CmdKey.S0407); //Z轴回零成功 } if (SPD != null && SPD.IsInit) { SPD.StopSpd(); ReportCmdKeyProgress(CmdKey.S0607); } HwProvider.UnInitHardwareDriver(); //关闭所有硬件 ReportCmdKeyProgress(CmdKey.S0023); //判定是否需要延迟断电 backWorker.CancelAsync(); LogHelper.CloseLogerConnect(); } catch { } if (shutDown) { ProcessCmd.SetSystemShutdown(); } else { //ProcessCmd.ShowWindowDesk();//显示Window桌面 //ProcessCmd.ShowLogicalDriver();//显示硬盘 //ProcessCmd.UsedTaskMgrForm();//使用任务管理器 //ProcessCmd.SetSystytemLoadShell(true);//设置系统默认加载路径并注销系统 } Application.Exit(); return(true); }