private void Grid_Load(object sender, RoutedEventArgs e) { try { string PortName = OperationConfig.GetValue("cardcom"); if (OperationConfig.GetValue("CardSort") == "USB") { ruc = new UsbICCard(PortName); } else { ruc = new ComICCard(PortName); } if (ruc.IsOpen()) { thead3 = new Thread(ruc.Read); thead3.Start(); ruc.HandDataBack -= BackCardID; ruc.HandDataBack += BackCardID; } else { idcardError.Visibility = Visibility.Visible; } } catch { idcardError.Visibility = Visibility.Visible; } }
void UpdateCardInfo() { try { this.Cursor = Cursors.Wait; if (OperationConfig.GetValue("CardSort") == "USB") { Getuserinfo(backcard); } //else //{ // filterdata.CardId = backcard; // filterdata.resetCard(); // string cardid = filterdata.getcardid(); // if (cardid == "") // return; // Getuserinfo(cardid); // filterdata.resetid(""); //} //this.tb_wrenchbarcode.Focus(); //showjuser(_juser); //showzuser(_zuer); //this.Cursor = Cursors.Arrow; } catch { } }
//void OnTimedEvent(object serder, EventArgs e) //{ // //this.Dispatcher.Invoke(DispatcherPriority.Normal, // // new TimerDispatcherDelegate(UpdateCardInfo)); //} void UpdateCardInfo() { try { if (OperationConfig.GetValue("CardSort") == "USB") { this.tb_cardid.Text = backcard; } else { filterdata.CardId = backcard; filterdata.resetCard(); string cardid = filterdata.getcardid(); if (cardid == "") { return; } filterdata.resetid(""); this.tb_cardid.Text = cardid; } } catch { } }
private void PrintItem() { var printDocument = new PrintDocument(); printDocument.PrintPage += printDocument_PrintPage; printDocument.DefaultPageSettings.PaperSize = new PaperSize("票据", 200, 120);//设置纸张的大小 printDocument.PrinterSettings.PrinterName = OperationConfig.GetValue("PrintName"); printDocument.Print(); }
public MyTabitem(users juser, users zuser) { InitializeComponent(); _juser = juser; _zuser = zuser; confarry = Convert.ToInt16(OperationConfig.GetValue("arry")); confcount = Convert.ToInt16(OperationConfig.GetValue("count")); cb_errorrangbinding(); }
private void readcard() { try { port = new SerialPort(); port.PortName = OperationConfig.GetValue("cardcom"); port.BaudRate = Convert.ToInt32(OperationConfig.GetValue("cardrate")); port.DataBits = 8; port.Open(); _keepreading = true; _thread = new Thread(ReadCard); _thread.Start(); } catch { } }
void UpdateCardInfo() { try { string cardid; if (OperationConfig.GetValue("CardSort") == "USB") { this.cardid.Text = backcard; cardid = backcard; } else { filterdata.CardId = backcard; filterdata.resetCard(); cardid = filterdata.getcardid(); if (cardid == "") { return; } filterdata.resetid(""); this.cardid.Text = cardid; } borrowuser = getuser.getuserinfo(getuser.getusers(cardid)); if (borrowuser != null && borrowuser.user != null) { this.username.Text = borrowuser.user.username; this.telphone.Text = borrowuser.user.phoneNumber; this.cb_user.IsEnabled = true; _returnwrench = GetBorrowInfo(borrowuser.user.guid); BorrowdgBind(_returnwrench); } else { this.username.Text = ""; this.telphone.Text = ""; } } catch { } }
public Main(ICardHelper _ruc) { this.ruc = _ruc; this.taskbarNotifier = new WinTaskbarNotifier(); InitializeComponent(); // this.taskbarNotifier.Show(); #region aTimer = new System.Timers.Timer(100); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Interval = 100; aTimer.Enabled = true; string msg = ""; try { getsystemset(); // 校验仪 try { rct1 = new ReadCheckTester(_t1); thead1 = new Thread(rct1.Read); thead1.Start(); //if (!_t1.IsOpen) // _t1.Open(); } catch { msg += "校验仪1链接失败\r\n"; strerror += "校验仪1链接失败"; } try { rct2 = new ReadCheckTester(_t2); thead2 = new Thread(rct2.Read); thead2.Start(); //if (!_t2.IsOpen) // _t2.Open(); } catch { msg += "校验仪2链接失败\r\n"; strerror += "---校验仪2连接失败"; } EncoderPlcPort.PortName = OperationConfig.GetValue("encodercom"); EncoderPlcPort.BaudRate = 9600; EncoderPlcPort.DataBits = 7; EncoderPlcPort.StopBits = StopBits.One; EncoderPlcPort.Parity = Parity.Even; try { if (!EncoderPlcPort.IsOpen) { EncoderPlcPort.Open(); } } catch { msg += "编码器链接失败\r\n"; strerror += "---编码器连接失败"; } if (msg != "") { MessageBox.Show(msg); } this.porterror.Content = strerror; } catch { LogUtil.WriteLog(typeof(Main), "端口打开失败!,设置端口名称不能为空!"); return; } #endregion }