//private void Api_ReceiveControlEvent(string receiveData, string runCode, string errorInfo) //{ // bool flag = errorInfo != string.Empty; // if (flag) // { // //LogHelper.WriteLog(new LogHelper // //{ // // Message = "ReceiveControlEvent Error", // // StackTrace = errorInfo // //}); // } //} //private void Api_RunErrorEvent(string Model, string SendCode, string ReceiveCode, string ErrorString) //{ // StringBuilder stringBuilder = new StringBuilder(); // stringBuilder.AppendLine("发送代码:" + SendCode); // stringBuilder.AppendLine("接收代码:" + ReceiveCode); // stringBuilder.AppendLine("错误信息:\r\n" + ErrorString); // this.ErrorInfo = stringBuilder.ToString(); // //LogHelper.WriteLog(new LogHelper // //{ // // Message = "RunErrorEvent Error", // // StackTrace = stringBuilder.ToString() // //}); //} //private void Api_ReadCardDataEvent(string cardStr, string blockStr, string baseStr, string errorStr) //{ // //*******************记录出票信息 即销售明细的来源************* // // // //*******************记录出票信息 即销售明细的来源************* // bool flag = errorStr != string.Empty; // if (flag) // { // //LogHelper.WriteLog(new LogHelper // //{ // // Message = "ReadCardDataEvent Error", // // StackTrace = errorStr // //}); // } //} private void Page_Loaded(object sender, RoutedEventArgs e) { this.locktag = false; this.isError = false; //this.cardCount = this.parent.SelfHelpInfo.TicketCount; this.cardCount = this.parent.mSelfHelpClass.TicketCount; //票数 自助售票类 this.OutCardCount = this.parent.mSelfHelpClass.TicketCount; //票数 待出票数 自助售票类 //this.web.Source = new Uri(AppDomain.CurrentDomain.BaseDirectory + "flash\\f6.swf"); this.counttimer.Start(); this.cardNo = string.Empty; this.parent.ResumeSecond(); //this.ss.SelectVoiceByHints(VoiceGender.Female); //this.ss.SpeakAsync("正在出票请稍后!"); // this.parent.SelfHelpInfo.TicketNumberList = new List<string>(); //strbuilder = new StringBuilder(); // ****************读卡线程************* string strSAM = M_Configuration.Samreadername; string strRFID = M_Configuration.RfidReadername; string strPIN = M_Configuration.Pin; try { rfidReader = TicketHandlerAdapter.getRfidTicketHandler(Convert.ToInt32(M_Configuration.CLIENTID), strRFID, strSAM, Encoding.ASCII.GetBytes(strPIN)); } catch (Exception ex) { _log.Error(typeof(GPPage6), ex); // MessageBox.Show("初始化失败,请确认读卡器选择正确!"); // this.parent.EndOperation(); this.parent.Err_Info = "设备故障,请到人工窗口取票。";//"读卡器初始化失败!\r\n请确认读卡器选择是否正确!"; this.parent.Operation("error"); return; } wkThread = new Thread(new ThreadStart(OutPutTicket)); //new Thread(new ThreadStart(DoWork)); wkThread.IsBackground = true; wkThread.Start(); //****************读卡线程************* this.btn_FH.Visibility = Visibility.Hidden; this.btn_FH.IsEnabled = false; this.btn_SY.Visibility = Visibility.Hidden; this.btn_SY.IsEnabled = false; }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { WinSleepCtr.PreventScreenSave(); WinSleepCtr.PreventSleep(true); //*******************端口连接部分 T_ReadConfig.ReadConfig(); //读取配置文件 T_ReadConfig.GetPIN(); //获取PIN码 AUTHORIZATION auth = new AUTHORIZATION(); auth.ClientId = M_Configuration.CLIENTID; //终端号 auth.Token = M_Configuration.TOKEN; //ConfigurationManager.AppSettings["Token"].ToString();//授权码 Client = new T_RpcClient(auth, M_Configuration.HOST, M_Configuration.PORT, M_Configuration.TIMEOUT); //StateClient = new T_RpcClient(auth, M_Configuration.HOST, M_Configuration.PORT, M_Configuration.TIMEOUT); // HeartClient = new T_RpcClient(auth, M_Configuration.HOST, M_Configuration.PORT, M_Configuration.TIMEOUT);//心跳 //票种名称 M_Configuration.RunState = 0;//自助售票运行状态 0表示正常 M_Configuration.TicketID_AName = T_SellTicketRecord.GetTicketTypeName(M_Configuration.TicketTypeID_1); M_Configuration.TicketID_BName = T_SellTicketRecord.GetTicketTypeName(M_Configuration.TicketTypeID_2); #region//暂时不用 ////获取票种信息 //try //{ // M_TicketTypeList.listTicketType = Client.TicketTypeSyncRpc(T_Date.ConvertDataTimeToLong(DateTime.Now)); //} //catch (Exception ex) //{ // _log.Error(typeof(MainWindow), ex); //} ////获取售售期信息 //try //{ // M_PeriodList.listPeriod = Client.SalePeriodSyncRpc(T_Date.ConvertDataTimeToLong(DateTime.Now)); //} //catch (Exception ex) //{ // _log.Error(typeof(MainWindow), ex); //} #endregion ////启动数据同步线程 _DataSyncThread = new Thread(new ThreadStart(_theadDeal.DataSyncThread)); _DataSyncThread.Name = "DataSyncThread"; _DataSyncThread.IsBackground = true; _DataSyncThread.Start(); _DataSyncThread.Priority = ThreadPriority.BelowNormal; Thread.Sleep(10); if (_DataSyncThread.IsAlive) { _log.Info("数据同步工作线程启动成功。"); } ////*******************端口连接部分 //强制回收线程 TGCThread = new T_GCThread(); GCThread = new Thread(new ThreadStart(TGCThread.DoWork)); GCThread.IsBackground = true; GCThread.Start(); if (GCThread.IsAlive) { _log.Error("强制回收线程启动成功!"); } string strSAM = M_Configuration.Samreadername; string strRFID = M_Configuration.RfidReadername; string strPIN = M_Configuration.Pin; try { rfidReaderTest = TicketHandlerAdapter.getRfidTicketHandler(Convert.ToInt32(M_Configuration.CLIENTID), strRFID, strSAM, Encoding.ASCII.GetBytes(strPIN)); } catch { // MessageBox.Show("初始化失败,请确认读卡器选择正确!"); } this.totaltimeout = int.Parse(ConfigHelper.GetConfigValue("window", "totaltimeout"));//操作最长时间 this.InitControlSize(); base.WindowState = WindowState.Maximized; base.WindowStyle = WindowStyle.None; base.ResizeMode = ResizeMode.NoResize; base.Left = 0.0; base.Top = 0.0; this.notice = new NoticePage(ConfigHelper.GetConfigValue("window", "notice"), double.Parse(ConfigHelper.GetConfigValue("window", "noticefontsize"))); this.topFrame.Content = this.notice; //this.videopage = new VideoPage(this); //this.topFrame.Content = this.videopage; this.imagepage = new ImageShowPage(this); this.middleFrame.Content = this.imagepage; pageTest = new FirstPage(this); this.operationpage = pageTest;//new FirstPage(this); this.mainFrame.Content = this.operationpage; //bool flag = SystemInfo.GetAllNetInfo() != null; //if (flag) //{ // this.MacStr = SystemInfo.GetAllNetInfo()[0].PhysAddr; //} this.countdowntimer = new DispatcherTimer(); this.countdowntimer.Interval = new TimeSpan(0, 0, 0, 1, 0); this.countdowntimer.Tick += new EventHandler(this.timer_Tick); this.countdowntimer.Start(); } catch (Exception ex) { _log.Error("服务器连接失败!"); _log.Error(typeof(MainWindow), ex); MessageBox.Show("服务器连接失败!", T_SellTicketRecord.str_Apption, MessageBoxButton.OK, MessageBoxImage.Information); base.Close(); } }