public void HandleRfidStatusEvent(object sender, RfidReaderEventArgs e) { if (_state == LadeskabState.Available || _state == LadeskabState.Locked) { RfidDetected(e.ReadRFID); } }
private void readerControllerImpler_ReaderTagsHandle(object sender, RfidReaderEventArgs e) { List <ProductBiz> epcProducts = new List <ProductBiz>(); foreach (var epc in e.EpcDtos) { epcs.Add(epc.EpcCode); } IList <SkuInfoBiz> SkuInfos = Global.dataservice.GetSkusByEpcList(epcs); if (SkuInfos == null) { return; } for (int i = 0; i < SkuInfos.Count; i++) { ProductBiz product = ProductBiz.GetProductBySkuInfo(SkuInfos[i]); product.ImagePath = Global.ProductDemoImages[i]; epcProducts.Add(product); } this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { if (Global.UserInterface == UserInterface.FittingRoom) { Global.MainFrame.Navigate(new Uri("/Views/ProductTryingOnControl.xaml", UriKind.Relative), epcProducts); } else { Global.MainFrame.Navigate(new Uri("/Views/ProductDetailControl.xaml", UriKind.Relative), epcProducts); } Global.MainFrame.Navigated += MainFrame_Navigated; }); }
public void Setup() { _receivedRfidEventArgs = null; _uut = new RfidReader(); _uut.RfidReaderEvent += (o, args) => { _receivedRfidEventArgs = args; }; }
//private void AddDataToGridView() //{ // string sEpcUnion = string.Join("','", EpcList.Where(x => x.isAdd == false).ToList().Select(x => x.Epc).ToArray()); // sEpcUnion = sEpcUnion.Length > 0 ? "'" + sEpcUnion + "'" : sEpcUnion; // if (sEpcUnion.Length > 0) // { // DataRow[] drSet = dtItem.Select(" epc in (" + sEpcUnion + ")"); // if (drSet.Length > 0) // { // decimal dAmt = decimal.Parse(lblTotalAmt.Text.Replace("¥", "")); // foreach (DataRow dr_tmp in drSet) // { // gvItem.AddNewRow(); // gvItem.SetFocusedRowCellValue(colepc, dr_tmp["epc"]); // //gvItem.SetFocusedRowCellValue(colsmallPic, dr_tmp["smallPic"]); // gvItem.SetFocusedRowCellValue(colbarcode, dr_tmp["barcode"]); // gvItem.SetFocusedRowCellValue(colitem, dr_tmp["item"]); // gvItem.SetFocusedRowCellValue(colcolorName, dr_tmp["colorName"]); // gvItem.SetFocusedRowCellValue(colsizeName, dr_tmp["sizeName"]); // gvItem.SetFocusedRowCellValue(colprice, dr_tmp["price"]); // gvItem.SetFocusedRowCellValue(colName, dr_tmp["name"]); // gvItem.SetFocusedRowCellValue(colqty, 1); // gvItem.SetFocusedRowCellValue(colamt, dr_tmp["price"]); // dAmt = dAmt + decimal.Parse(dr_tmp["price"].ToString()); // EpcList.Where(x => x.isAdd == false && x.Epc == dr_tmp["epc"].ToString()).ForEach(x => x.isAdd = true); // } // gvItem.AddNewRow(); // gvItem.DeleteRow(gvItem.FocusedRowHandle); // //计算总数量 总金额 // lblTotalQty.Text = gvItem.RowCount.ToString(); // lblTotalAmt.Text = "¥" + dAmt.ToString(); // } // } //} private void readerController_ReaderTagsHandle(object sender, RfidReaderEventArgs e) { //e.EpcDtos.ForEach(epc => //{ // if (EpcList.Count == 0 || !(EpcList.Any(x => x.Epc == epc.EpcCode))) // { // EPC_READ_STATUS epc_tmp = new EPC_READ_STATUS(); // epc_tmp.Epc = epc.EpcCode; // epc_tmp.isAdd = false; // EpcList.Add(epc_tmp); // } //}); //this.InvokeIfRequired(() => //{ // AddDataToGridView(); //}); }
private void _readerControllerImpler_ReaderTagsHandle(object sender, RfidReaderEventArgs e) { string epccode = e.EpcDtos[0].EpcCode; //System.Windows.MessageBox.Show(e.EpcDtos[0].EpcCode); DataService service = new DataService(); SkuBiz sku = service.GetProductByEpc(epccode); _readerControllerImpler.StopAndDisconnect(); //WPFMessageBox.Show(e.EpcDtos[0].EpcCode); //BackgroundWorker bgw = new BackgroundWorker(); //bgw.WorkerSupportsCancellation = true; //bgw.WorkerReportsProgress = true; //bgw.DoWork += new DoWorkEventHandler((s1, e1) => //{ // //foreach (var epc in e.EpcDtos) // //{ // // if (EpcList.Count == 0 || !(EpcList.Any(x => x.Epc == epc.EpcCode))) // // { // // EPC_READ_STATUS epc_tmp = new EPC_READ_STATUS(); // // epc_tmp.Epc = epc.EpcCode; // // epc_tmp.isAdd = false; // // EpcList.Add(epc_tmp); // // } // //} //}); //bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler((s2, e2) => //{ // //AddDataToGridView(); //}); //bgw.RunWorkerAsync(); ////this.InvokeIfRequired(() => ////{ //// //数据显示 //// //AddDataToGridView(); ////}); }