Example #1
0
        private async void TxtPartNumber_EditorAction(object sender, TextView.EditorActionEventArgs e)
        {
            DataRecord result;

            e.Handled = false;
            if (e.ActionId == ImeAction.Send)
            {
                DismissKeyboard();
                try
                {
                    result = await DataBaseAccess.GetData(txtPartNumber.Text, hF.spnDB.SelectedItem.ToString());
                } catch (Exception ex)
                {
                    Toast.MakeText(Activity, ex.Message, ToastLength.Long).Show();
                    sF.txtStatus.Text  = ex.Message;
                    txtPartNumber.Text = "";
                    e.Handled          = true;
                    return;
                }
                //result = await DataBaseAccess.GetData(txtPartNumber.Text, hF.spnDB.SelectedItem.ToString());
                UpdateValues(result);
                sF.txtStatus.Text = "Partnumber found!";
                //Toast.MakeText(Activity, "Value Entered: " + txtPartNumber.Text, ToastLength.Short).Show();
                e.Handled = true;
            }
        }
Example #2
0
        private async void BtnScan_Click(object sender, EventArgs e)
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner();
            var scan    = await scanner.Scan();

            var scanText = scan.Text;

            if (scan != null)
            {
                //"[)>06PDS7316F126AAQ56VGN2LCD0621881298V0145A1L3HM500913274N5570748829BKLT64291T 3299"
                if (scanText.Substring(0, 3) == "[)>") //PDF labels
                {
                    var scanSplit = scanText.Split((char)29);
                    scanText = scanSplit.FirstOrDefault <string>(x => x.Substring(0, 1) == "P").Substring(1) ?? "";
                }
                txtPartNumber.Text = scanText.Replace("-", "").Replace(" ", "");

                DataRecord result;
                DismissKeyboard();
                try
                {
                    result = await DataBaseAccess.GetData(txtPartNumber.Text, hF.spnDB.SelectedItem.ToString());
                }
                catch (Exception ex)
                {
                    Toast.MakeText(Activity, ex.Message, ToastLength.Long).Show();
                    //sF.txtStatus.Text = ex.Message;
                    sF.txtStatus.Text  = scan.Text;
                    txtPartNumber.Text = "";
                    return;
                }
                //result = await DataBaseAccess.GetData(txtPartNumber.Text, hF.spnDB.SelectedItem.ToString());
                UpdateValues(result);
                sF.txtStatus.Text = "Partnumber found!";
            }


            //Toast.MakeText(Activity, "Value Entered: " + txtPartNumber.Text, ToastLength.Short).Show();
        }