/// <summary> /// 程序初始化 /// </summary> private void Initialize() { try { //if (!InspectKit.Inspect(SysConfigHelper.readerNode("Inspect")))//对比失败 //{ // //打开主页面 // MainWindow mainWindow = new MainWindow(); // mainWindow.Show(); // MainWindow.Margin = new Thickness(-10, -8, -12, -10); // FormStop stop = new FormStop(); // stop.Margin = new Thickness(0, 0, 0, 0); // MainWindow.Content = stop; // return; //} //北岸公馆读卡器注册表 SysBLL.RunBat(System.AppDomain.CurrentDomain.BaseDirectory + "\\BeiAnGGOcx\\00010001\\wyzh.bat"); SysBLL.RunBat(System.AppDomain.CurrentDomain.BaseDirectory + "\\BeiAnGGOcx\\00010001\\0001.bat"); //物业2 SysBLL.RunBat(System.AppDomain.CurrentDomain.BaseDirectory + "\\perp2\\prop2.bat"); //SysBLL.RunBat(System.AppDomain.CurrentDomain.BaseDirectory + "\\BeiAnGGOcx\\wyzh.bat"); //是否需要启动其他程序 bool startUpOtherProject = Convert.ToBoolean(SysConfigHelper.readerNode("startUpOtherApp")); if (startUpOtherProject) { StartUpApp(SysConfigHelper.readerNode("startUpOtherAppPath")); } //关闭广告屏 killGcMp4(); //获取缴费页面提示 SysBLL.payPromptInfo = PayPromptAccess.queryPayPrompt(null); SysBLL.ShowCursor(SysBLL.IsShowCursor); //设置桌面背景 SysBLL.setImagePage(); //天气查询状态 SysBLL.WeatherQuerystate = 1; //禁止用户插卡 MachCardBLL.CancelWaitCard(); //初始化发送设备状态时间 SysBLL.SendDeviceStatuTime = DateTime.Now; if (SysBLL.IsTest.Equals("正式")) { //广告ID GCResourceAccess.adv_id = GcManage.ReadGCID(); //指令id SystemOrderAccess.id = ComputerBLL.ReadOrderID(); } else { //广告ID GCResourceAccess.adv_id = SysConfigHelper.readerNode("GcAdv_id"); //指令id SystemOrderAccess.id = SysConfigHelper.readerNode("sysOrderId"); } //电动读卡器如果有卡则吞卡 //MachCardBLL.swallowCard(); } catch (Exception ex) { logger("error:程序初始化异常:" + ex.Message); } }
private void Button_Click_6(object sender, RoutedEventArgs e) { try { //如果有卡则退卡 MachCardBLL.backCard(); //禁止用户插卡 MachCardBLL.CancelWaitCard(); }catch (Exception ex) { log.Write("error:维护人员签到页面退卡异常:" + ex.Message); } }
/// <summary> /// 主程序初始化 /// </summary> private void Initialize() { //鼠标显示或隐藏 SysBLL.ShowCursor(SysBLL.IsShowCursor); //设置页面滚动信息 this.GClbl.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), this.GClbl, SysConfigHelper.readerNode("mainTopInfo")); //绑定天气更新事件 this.weatherWorker.DoWork += new DoWorkEventHandler(this.weatherWorker_DoWork); this.weatherWorker.RunWorkerAsync(); //绑定发送设备状态事件 SysBLL.SendDeviceWorker = new BackgroundWorker(); SysBLL.SendDeviceWorker.DoWork += new DoWorkEventHandler(this.SendDeviceWorker_DoWork); SysBLL.SendDeviceWorker.RunWorkerAsync(); //获取命令 systemOrderWorker.DoWork += new DoWorkEventHandler(this.systemOrderWorker_DoWork); systemOrderWorker.RunWorkerAsync(); //如果有卡则退卡 MachCardBLL.backCard(); //禁止用户插卡 MachCardBLL.CancelWaitCard(); }
private void readCard() { try { Thread.Sleep(1500); //等待用户插卡 MachCardBLL.waitCard(); } catch (ThreadAbortException ae) { log.Write("error:" + ae.Message); } catch (Exception ex) { log.Write("error:插卡页readCard():" + ex.Message); } while (true) { try { Thread.Sleep(700); //卡机内是否有卡 if (!MachCardBLL.CardUsable()) { continue; } PrintInfo("正在读卡,请稍后..."); Thread.Sleep(1500); } catch (ThreadAbortException ae) { log.Write("error:" + ae.Message); } catch (Exception ex) { log.Write("error:插卡页readCard():" + ex.Message); } try { //签到 PayAccess.ReadSign(); string wtNo = wt.GetCardNo(); if (wtNo != null) { if (wtNo.Length == 16) { if (SysBLL.payCostType == 3) { //退卡 MachCardBLL.backCard(); //等待用户插卡 MachCardBLL.waitCard(); PrintInfo("暂不支持此卡,请取卡"); return; } else { SysBLL.payCardType = 1; SysBLL.payCardNo = wtNo; if (!pwdBLL.SetCryptMode(1)) { throw new Exception("系统异常,请稍后再试..."); //万通卡加密方式 } pwdBLL.closeKey(); //pwdBLL.OpenKeyboard(SysConfigHelper.readerNode("ZT598Port"), "9600", wtNo); if (!setPayParam(wtNo, null, wtNo)) { //PrintInfo("业务异常,请稍后再试..."); //退卡 MachCardBLL.backCard(); //等待用户插卡 MachCardBLL.waitCard(); return; } ; SysBLL.payTypeName = "甘肃一卡通"; WintopStatusInfo statusInfo = new WintopAccess().queryCardStatus(wtNo); if ((statusInfo.msgrsp.WTSTATE == null) || (statusInfo.msgrsp.WTSTATE.Equals(""))) { PrintInfo("业务正忙,请稍后再试"); //退卡 MachCardBLL.backCard(); //等待用户插卡 MachCardBLL.waitCard(); return; } if ("01".Equals(statusInfo.msgrsp.WTSTATE)) { //执行下一步操作 this.Dispatcher.Invoke(new Action(() => { Util.JumpUtil.jumpCommonPage("FormInputPassword"); })); return; } else { PrintInfo("该卡已挂失,无法正常使用"); //退卡 MachCardBLL.backCard(); //等待用户插卡 MachCardBLL.waitCard(); return; } } } } dictionary = null; //银行卡 dictionary = BankBLL.ReadBankCard(); SysBLL.IcBankDictionary = dictionary; //if (SysBLL.payCostType == 3) //{ SysBLL.payCardType = 0; SysBLL.payCardNo = dictionary["cardNo"]; if (!pwdBLL.SetCryptMode(0)) { throw new Exception("系统异常,请稍后再试..."); //拉卡拉加密方式 } pwdBLL.closeKey(); //pwdBLL.OpenKeyboard(SysConfigHelper.readerNode("ZT598Port"), "9600", dictionary["cardNo"]); //if (!setPayParam("", dictionary, dictionary["cardNo"])) throw new Exception("查询失败"); if (!setPayParam("", dictionary, dictionary["cardNo"])) { return; } ; SysBLL.payTypeName = "银行卡"; this.Dispatcher.Invoke(new Action(() => { Util.JumpUtil.jumpCommonPage("FormInputPassword"); })); return; //} //else //{ // //退卡 // MachCardBLL.backCard(); // //等待用户插卡 // MachCardBLL.waitCard(); // PrintInfo("暂不支持此卡,请取卡"); //} } catch (ThreadAbortException ae) { log.Write("error:读卡失败:" + ae.Message); return; }catch (WtException we) { log.Write("error:读卡异常"); PrintInfo("读取失败"); //退卡 MachCardBLL.backCard(); //等待用户插卡 MachCardBLL.waitCard(); } catch (Exception ex) { log.Write("error:读卡异常:" + ex.Message); PrintInfo("读取失败"); //退卡 MachCardBLL.backCard(); //等待用户插卡 MachCardBLL.waitCard(); } finally { //btnOkBg.Enabled = true; } } }
private void load() { try { ConfigSysParam.gifBusiness = GifBusiness.no; ComputerBLL.KillApplication("TabTip"); //支付方式默认为电子现金 PayStaticParam.payType = -1; //设置页面终端号 this.lblMechineNo.Text = "NO:" + ConfigurationManager.AppSettings["MechineNo"]; SysBLL.PasswordErrorInfo = "重要提示"; //软件版本号 this.lblVersion.Text = SysConfigHelper.readerNode("currentVersion"); loadThread = new Thread(delegate() { //如果有卡则退卡 MachCardBLL.backCard(); //禁止用户插卡 MachCardBLL.CancelWaitCard(); }); loadThread.Start(); SysBLL.IsOpenIndexForm = true; //初始化公积金查询参数 SysBLL.customerParam = null; SysBLL.customerParam = new wtPayModel.PublicFundModel.CustomerParam(); SysBLL.socialSecurityParam = null; SysBLL.socialSecurityParam = new wtPayModel.SocialSecurityModel.SocialSecurityParam(); BeiAnGGCardBLL.killRd(); Write(@"D:\appliaction\IsRestart.txt", "1"); Console.WriteLine(Read(@"D:\appliaction\IsRestart.txt")); if (SysBLL.isGcWindow == false) { gcWindowThread = new Thread(delegate() { try { while (true) { try { int sleepNum = Convert.ToInt32(SysConfigHelper.readerNode("Gcmp4PlayIntervalName")); Thread.Sleep(sleepNum); if (!System.IO.File.Exists("D:/payMedia/mp4/1.mp4")) { ComputerBLL.KillApplication("GCMp4"); continue; } System.Diagnostics.Process p = new System.Diagnostics.Process(); if (("0".Equals(SysConfigHelper.readerNode("isStopGCMp4"))) || ("2".Equals(SysConfigHelper.readerNode("isStopGCMp4")))) { p.StartInfo.FileName = System.AppDomain.CurrentDomain.BaseDirectory + "GCMp4.exe"; p.Start(); SysConfigHelper.writerNode("isMainClose", "1"); } while (true) { System.Diagnostics.Process[] proList = System.Diagnostics.Process.GetProcesses(".");//获得本机的进程 bool iss = false; foreach (System.Diagnostics.Process pro in proList) { if ("GCMp4".Contains(pro.ProcessName)) { iss = true; break; } } if ("1".Equals(SysConfigHelper.readerNode("isStopGCMp4"))) { ComputerBLL.KillApplication("GCMp4"); } if (iss == false) { break; } Thread.Sleep(1000 * 5); } } catch (ThreadAbortException ae) { log.Write("error:1loadGCMp4:" + ae.Message); return; } catch (Exception ex) { log.Write("error:视屏循环播放:" + ex.Message + ex.InnerException); continue; } } } catch (ThreadAbortException ae) { log.Write("error:2loadGCMp4:" + ae.Message); return; } catch (Exception ex) { log.Write("error:2loadGCMp4:" + ex.Message); } }); gcWindowThread.Start(); } //隐藏Windows任务栏 SysBLL.ShowWindow(SysBLL.FindWindow("Shell_TrayWnd", null), SysBLL.SW_HIDE); } catch (ThreadAbortException ae) { log.Write("error:" + ae.Message); } catch (Exception ex) { log.Write("error:首页load事件异常:" + ex.Message); } }