private void Logo_Load(object sender, EventArgs e) { base.SetVisibleCore(false);//屏蔽ALT+TAB切换 Process.GetCurrentProcess().PriorityBoostEnabled = true; Common.ProgressCmdKeyChanged += Common_ProgressChanged; if (ProcessCmd.CheckMachineRegistKeyIsValid()) { if (ProcessCmd.CheckMachineRegistValueIsValid()) { timer2.Enabled = true; panel1.Visible = false; Common.SetSystemWorkMode(SysFunState.Load); return; } } DialogResult re = MessageBox.Show(string.Format("系统未进行注册或发生设备环境变更\n点击 '确认' 进行注册\n点击 '取消' 系统将于三分钟后关闭\n"), "系统警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (re == DialogResult.OK) { maskKey.Text = Com.Checksum.GetRegiterKeys(); logoText.Text = "请向厂家技术人员提供注册秘钥"; } else { maskKey.Text = Com.Checksum.GetRegiterKeys(); ProcessCmd.SetSystemShutdown(180); } panel1.Visible = true; panel1.SelectedIndex = 1; timer2.Enabled = false; }
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); }
// 8AEFE7 private void ExitApplition_Click(object sender, EventArgs e) { Common.SystemExit(true, true); ProcessCmd.SetSystemShutdown(); }