コード例 #1
0
        public void OnScanEvent(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
            {
                IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();

                foreach (ScanDataCollection.ScanData data in scanData)
                {
                    try
                    {
                        string dataString = data.Data;

                        Console.WriteLine("ESCANER DATA:  " + dataString);

                        redirectPrice(dataString);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
        }
コード例 #2
0
        public void OnScanEvent(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
            {
                IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();

                foreach (ScanDataCollection.ScanData data in scanData)
                {
                    try
                    {
                        string dataString = data.Data;

                        RunOnUiThread(() =>
                        {
                            MessagingCenter.Send(Xamarin.Forms.Application.Current, "InitialScan", dataString);
                        });
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
        }
コード例 #3
0
ファイル: MainActivity.cs プロジェクト: frs535/LitleW
        void OnScanReceived(object sender, Scanner.DataEventArgs args)
        {
            var scanDataCollection = args.P0;

            if (scanDataCollection?.Result == ScannerResults.Success)
            {
                //var textView = FindViewById<TextView>(Resource.Id.last_scan_received);
                //if (textView != null)
                //    textView.Text = scanDataCollection.GetScanData()[0].Data;
            }
        }
コード例 #4
0
        private void Scanner_Data(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
            {
                IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();

                string dataString = scanData.First().Data;
                Console.WriteLine(dataString);
            }
        }
コード例 #5
0
        void scanner_Data(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
            {
                IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();

                foreach (ScanDataCollection.ScanData data in scanData)
                {
                    //displaydata(data.LabelType + " : " + data.Data);
                    displaydata(data.Data);
                }
            }
        }
コード例 #6
0
        void scanner_Data(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
            {
                IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();

                foreach (ScanDataCollection.ScanData data in scanData)
                {
                    string dataString = data.Data;
                    RunOnUiThread(() => DisplayScanData(dataString));
                }
            }
        }
コード例 #7
0
ファイル: ZebraScanning.cs プロジェクト: chrisgate/ZebraForms
        void ReceivedScanData(object sender, Scanner.DataEventArgs e)
        {
            if (e.P0 != null && e.P0.Result == ScannerResults.Success)
            {
                var resultData  = e.P0.GetScanData();
                var firstResult = resultData.FirstOrDefault();

                if (firstResult != null)
                {
                    ScanResultFound?.Invoke(sender, new ScanResultEventArgs {
                        ScannedText = firstResult.Data
                    });
                }

                StopScanning();
            }
        }
コード例 #8
0
        void scanner_Data(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
            {
                IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();

                foreach (ScanDataCollection.ScanData data in scanData)
                {
                    Console.WriteLine(data.LabelType + " : " + data.Data);
                    var topic   = QrMessage.MESSAGE_SCANNED_TOPIC;
                    var message = new QrMessage(data.LabelType.ToString(), data.Data);

                    MessagingCenter.Send <QrMessage>(message, topic);
                }
            }
        }
コード例 #9
0
        void _scanner_Data(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if (scanDataCollection != null && scanDataCollection.Result == ScannerResults.Success)
            {
                IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();
                List <ScannedBarCodes> scannedBarCodes       = new List <ScannedBarCodes>();
                foreach (var data in scanData)
                {
                    string barCode   = data.Data;
                    string symbology = data.LabelType.Name();

                    scannedBarCodes.Add(new ScannedBarCodes(barCode, symbology));
                }
                this.OnBarcodeScanned?.Invoke(this, new OnBarcodeScannedEventArgs(scannedBarCodes));
            }
        }
コード例 #10
0
        private void scanner_Data(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
            {
                IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();

                List <ScannedBarCode> scannedBarCodes = new List <ScannedBarCode>();

                foreach (ScanDataCollection.ScanData data in scanData)
                {
                    //displaydata(data.LabelType + " : " + data.Data);
                    string barcode   = data.Data;
                    string symbology = data.LabelType.Name();

                    scannedBarCodes.Add(new ScannedBarCode(barcode, symbology));
                }

                this.OnBarcodeScanned?.Invoke(this, new OnBarcodeScannedEventArgs(scannedBarCodes));
            }
        }
コード例 #11
0
 void OnScanReceived(object sender, Scanner.DataEventArgs args)
 {
     // Pass the EMDK events to the our new event handler
     ScanReceived?.Invoke(sender, args);
 }
コード例 #12
0
ファイル: MainActivity.cs プロジェクト: YuraMelnikov/CMOSApp
 private void Scanner_Data(object sender, Scanner.DataEventArgs e)
 {
     try
     {
         if (part != "")
         {
             var scanDataCollection = e.P0;
             if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
             {
                 var scanData = scanDataCollection.GetScanData();
                 if (scanData[0].Data == null)
                 {
                     return;
                 }
                 string scanDataRes = GetSKUID(scanData[0].Data);
                 sku     = GetSKU(scanDataRes);
                 skuPart = GetSKUPart(scanDataRes);
                 if (part != skuPart && skuPart != "")
                 {
                     RunOnUiThread(() =>
                     {
                         AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                         AlertDialog alert          = dialog.Create();
                         alert.SetTitle("Ошибка партии");
                         alert.SetMessage(sku + " из другой партии");
                         alert.Show();
                         return;
                     });
                 }
                 else
                 {
                     try
                     {
                         pos          = positionsList.First(a => a.Code == sku && a.Rate < a.Norm);
                         pos.IsUpdate = true;
                         positionItem = positionsList.FindIndex(a => a.Id == pos.Id);
                         pos.Rate++;
                         maxCount = pos.Norm;
                         RunOnUiThread(() => codeInput.Text     = sku);
                         RunOnUiThread(() => quentityInput.Text = pos.Rate.ToString());
                         RunOnUiThread(() => weightInput.Text   = pos.Weight.ToString());
                         isEdit = true;
                     }
                     catch
                     {
                         RunOnUiThread(() =>
                         {
                             AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                             AlertDialog alert          = dialog.Create();
                             alert.SetTitle("ТМЦ не найдено");
                             alert.SetMessage(sku + " - нет/избыток");
                             alert.Show();
                             return;
                         });
                     }
                     if (weightInput.Text == "0")
                     {
                         RunOnUiThread(() =>
                         {
                             AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                             AlertDialog alert          = dialog.Create();
                             alert.SetTitle("Масса не задана");
                             alert.SetMessage(sku + " взвесте ТМЦ");
                             alert.Show();
                             return;
                         });
                     }
                     MainThread.BeginInvokeOnMainThread(() =>
                     {
                         adapterPosition = new PositionsAdapter(positionsList);
                         ordersRecyclerView.SetAdapter(adapterPosition);
                         ordersRecyclerView.ScrollToPosition(positionItem);
                     });
                     RunOnUiThread(ProcessScan);
                 }
             }
         }
         else
         {
             RunOnUiThread(() =>
             {
                 AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                 AlertDialog alert          = dialog.Create();
                 alert.SetTitle("Партия не выбрана");
                 alert.SetMessage("Нажмите на пункт партии");
                 alert.Show();
                 return;
             });
         }
     }
     catch (Exception ex)
     {
         ErrorMessage("MainActivity - Scanner_Data:" + ex.Message);
     }
 }
コード例 #13
0
        private void scanner_Data(object sender, Scanner.DataEventArgs e)
        {
            ScanDataCollection scanDataCollection = e.P0;

            if ((scanDataCollection != null) && (scanDataCollection.Result == ScannerResults.Success))
            {
                if (scanDataCollection.GetScanData() != null)
                {
                    IList <TableRow> rows = new List <TableRow>();
                    TableRow         row  = new TableRow(this);
                    row.SetBackgroundColor(Android.Graphics.Color.Black);
                    row.SetPadding(1, 1, 1, 1);
                    TableRow.LayoutParams llp = new TableRow.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.MatchParent);
                    llp.SetMargins(0, 0, 2, 0);

                    TextView keyText = new TextView(this);
                    keyText.SetPadding(5, 5, 5, 5);
                    keyText.LayoutParameters = llp;
                    //keyText.SetLayerType(llp);
                    keyText.SetBackgroundColor(Android.Graphics.Color.White);
                    keyText.Text = "Type";
                    row.AddView(keyText);

                    TextView valueText = new TextView(this);
                    valueText.SetPadding(5, 5, 5, 5);
                    valueText.SetBackgroundColor(Android.Graphics.Color.White);
                    valueText.Text = "Value";
                    row.AddView(valueText);

                    rows.Add(row);

                    IList <ScanDataCollection.ScanData> scanData = scanDataCollection.GetScanData();

                    foreach (ScanDataCollection.ScanData data in scanData)
                    {
                        string dataString = data.Data;
                        row = new TableRow(this);
                        row.SetBackgroundColor(Android.Graphics.Color.Black);
                        row.SetPadding(1, 1, 1, 1);

                        string mKey   = data.LabelType.ToString();
                        string mValue = data.Data;

                        keyText = new TextView(this);
                        keyText.SetPadding(5, 5, 5, 5);
                        keyText.LayoutParameters = llp;
                        keyText.SetBackgroundColor(Android.Graphics.Color.White);
                        keyText.Text = mKey;
                        row.AddView(keyText);

                        valueText = new TextView(this);
                        valueText.SetPadding(5, 5, 5, 5);
                        valueText.SetBackgroundColor(Android.Graphics.Color.White);
                        valueText.LayoutParameters = llp;
                        valueText.Text             = mValue;
                        row.AddView(valueText);

                        rows.Add(row);
                        //RunOnUiThread(() => DisplayScanData(mValue));
                        RunOnUiThread(() => DisplayScanData(dataString));
                    }
                    new AsyncMultiDataUpdate(rows).Execute("MultiBarcode Scanning result");
                }
            }
        }
コード例 #14
0
 private void Scanner_Data(object sender, Scanner.DataEventArgs data)
 {
     Log.Debug(TAG, $"Scanned Barcode(s): {data.P0.GetScanData()?.Select(d => d.Data)?.Aggregate((first, next) => first +", " + next)}");
     ScanDataReceived?.Invoke(sender, data.P0.GetScanData());
 }
コード例 #15
0
 private void OnScanReceived(object sender, Scanner.DataEventArgs args)
 {
     MainThread.BeginInvokeOnMainThread(() => ScanReceived?.Invoke(sender, args));
 }
コード例 #16
0
 private void DataReceived(object sender, Scanner.DataEventArgs e)
 {
     OnDataReceived?.Invoke(this, new EMDKDataReceivedArgs(PrepareReceivedData(e.P0), ""));
 }