private void ButtonStart_Click(object sender, EventArgs e) { try { mobileComputer.TurnOnScanner(); Toast.MakeText(this, "Mobile Computer TurnOnScanner OK", ToastLength.Short).Show(); } catch (Exception ex) { Toast.MakeText(this, "MobileComputer TurnOnScanner error - " + ex.ToString(), ToastLength.Long).Show(); } Button buttonStop = FindViewById <Button>(Resource.Id.buttonStopScan); buttonStop.Enabled = true; Button buttonStart = FindViewById <Button>(Resource.Id.buttonStartScan); buttonStart.Enabled = false; var textStatus = FindViewById <TextView>(Resource.Id.textScannerStatus); textStatus.Text = "Scanner Status: " + (mobileComputer.Scanner.IsTurnedOn ? "Enabled" : "Disabled"); }
private void ButtonCreate_Click(object sender, EventArgs e) { ThreadPool.QueueUserWorkItem((x) => { try { mobileComputer = PluginBarcodeMobileComputer.ConnectPluginMobileComputer("cleverence.com.plugin.magdennewlandnls_nquire1000", this);// new CustomMobileComputer(this); WaitUntilPluginScannerConnected(mobileComputer); RunOnUiThread(() => { Toast.MakeText(this, "Mobile Computer Constructor OK", ToastLength.Short).Show(); }); mobileComputer.Scan += MobileComputer_Scan; mobileComputer.TurnOnScanner(); RunOnUiThread(() => { Toast.MakeText(this, "Mobile Computer TurnOnScanner OK", ToastLength.Short).Show(); }); } catch (Exception ex) { //RunOnUIThread(() => { Toast.MakeText(this, "MobileComputer Constructor error - " + ex.ToString(), ToastLength.Long).Show(); }); return; } RunOnUiThread(() => { var buttonCreate = FindViewById <Button>(Resource.Id.buttonCreate); buttonCreate.Enabled = false; var buttonStart = FindViewById <Button>(Resource.Id.buttonStartScan); buttonStart.Enabled = false; var buttonStop = FindViewById <Button>(Resource.Id.buttonStopScan); buttonStop.Enabled = true; var buttonDispose = FindViewById <Button>(Resource.Id.buttonDispose); buttonDispose.Enabled = true; var buttonEan = FindViewById <Button>(Resource.Id.buttonEan13); var buttonPdf417 = FindViewById <Button>(Resource.Id.buttonPdf417); var buttonDataMatrix = FindViewById <Button>(Resource.Id.buttonDataMatrix); if (mobileComputer.Scanner != null) { var supported = mobileComputer.Scanner.GetSupportedSymbologies(); if (supported != null) { if (supported.Length > 0) { buttonDataMatrix.Enabled = true; buttonEan.Enabled = true; buttonPdf417.Enabled = true; buttonEan.Text = "Push to Ean13 Only"; buttonPdf417.Text = "Push to Pdf417 Only"; buttonDataMatrix.Text = "Push to DataMatrix Only"; } } } var textActive = FindViewById <TextView>(Resource.Id.textScannerStatus); var buttonSettings = FindViewById <Button>(Resource.Id.buttonSettings); if (mobileComputer.Scanner != null) { if (mobileComputer.Scanner.IsSettingsAvailable) { buttonSettings.Enabled = true; buttonSettings.Text = "Settings avalable"; } else { buttonSettings.Enabled = false; buttonSettings.Text = "Settings not avalable"; } var status = mobileComputer.Scanner.IsTurnedOn ? "Enabled" : "Disabled"; textActive.Text = "Scanner Status: " + status; } var textId = FindViewById <TextView>(Resource.Id.textDeviceId); textId.Text = "Device Id: " + mobileComputer.GetDeviceId(); var textKeyboard = FindViewById <TextView>(Resource.Id.textHasKeyboard); textKeyboard.Text = "Has Keyboard: " + (mobileComputer.HasKeyboard ? "Yes" : "No"); Toast.MakeText(this, "Mobile Computer HasKeyboard OK", ToastLength.Short); }); }); }