public String PrintDocment() { String error_str_t = null; this.Wait(); Debug.WriteLine(">>>>>>>>>进入打印+/n" + file.GetFileName()); LogHelper.WriteLog(this.GetType(), i++.ToString()); LogHelper.WriteLog(this.GetType(), ">>>>>>>>>进入打印+/n" + file.GetFileName()); #if true bool Success = false; #if true Success = printerOnLocal.PrintDocment(); #endif if (Success == false) { LogHelper.WriteLog(this.GetType(), "本地打印【失败】"); error_str_t = "机器故障"; #if USE_NET /*---本地打印失败-----*/ try { Success = printerOnNet.PrintDocment(); }catch (Exception e) { LogHelper.WriteLog(this.GetType(), e); } #endif } else { LogHelper.WriteLog(this.GetType(), "本地打印【成功】"); } /* if (false||LibCui.DeleteFileForce(file.mFileFullPath)) * { * LogHelper.WriteLog(this.GetType(), "文件【已删除】"); * } * else { * LogHelper.WriteLog(this.GetType(), "文件【删除失败】"); * }*/ // LibCui.DeleteFile(file.GetPCLprnfullPath()); #endif if (Success == true) { //打印成功-- PrintRecord pp = new PrintRecord(); pp.WriteRecord2Disk(file); // PcCloudComm.Notify_Thread(); } Debug.WriteLine("<<<<<<<<<<<退出打印"); LogHelper.WriteLog(this.GetType(), "<<<<<<<<<<<退出打印"); this.Release(); return(error_str_t); }
/// <summary> /// 单例模式 /// </summary> /// <param name="e"></param> protected override void OnStartup(StartupEventArgs e) { // Get Reference to the current Process Process thisProc = Process.GetCurrentProcess(); if (is64BitProcess) { MessageBox.Show("不支持64位"); Application.Current.Shutdown(); return; } // Check how many total processes have the same name as the current one if (Process.GetProcessesByName(thisProc.ProcessName).Length > 1) { // If ther is more than one, than it is already running. MessageBox.Show("Application is already running."); Application.Current.Shutdown(); return; } //设置开机自动启动 try{ this.SetAutoRun(Assembly.GetExecutingAssembly().Location, true); }catch (Exception ex) { LogHelper.WriteLog(this.GetType(), ex); MessageBox.Show("【失败】开机自启动设置"); } //检查PCL 打印机---PDF 文件必须支持 if (!PrintLocalPrint.HaveOnePclPrinter()) { MessageBox.Show("【PCL】没有PCL打印机"); } //推荐使用的服务器Ip地址 String ip_result = PhonePcCommunication.IsRecommendIpAddress(); if (!"true".Equals(ip_result)) { MessageBox.Show("【IP推荐】" + ip_result); } //通知本地服务器 PcCloudComm.Notify_Thread(); //保存编译时间到本地 UpdatePackage.Check2DownloadThread(); base.OnStartup(e); }