protected override void OnClose() { //comm.StopScan(); //pcbComm.StopScan(); engine.exit(); if (engine.work_thread != null) { engine.work_thread.Join(); } CanComm.OnError -= Comm_OnError; CanComm.Close(); if (System.Windows.Application.Current.ShutdownMode == System.Windows.ShutdownMode.OnMainWindowClose) { TraceService.InsertT_Trace(TraceLevelEnum.LowImportant, "关闭主程序"); } else { TraceService.InsertT_Trace(TraceLevelEnum.LowImportant, "注销"); } foreach (var key in Constants.BJDict.Keys) { switch (key) { case "T_BJ_DeepPlate": { VBJ.SaveConfig(Constants.BJDict[key]); break; } } } base.OnClose(); System.Environment.Exit(0); }