void barcodeManager_Connection(object sender, BarcodeManager.ScannerConnectionEventArgs e)
        {
            string status;
            string scannerName = "";

            ScannerInfo scannerInfo = e.P0;

            BarcodeManager.ConnectionState connectionState = e.P1;

            string statusBT      = connectionState.ToString();
            string scannerNameBT = scannerInfo.FriendlyName;

            if (scannerList.Count != 0)
            {
                scannerName = scannerList[scannerIndex].FriendlyName;
            }

            if (scannerName.ToLower().Equals(scannerNameBT.ToLower()))
            {
                status = "Status: " + scannerNameBT + ":" + statusBT;
                RunOnUiThread(() => textViewStatus.Text = status);

                if (connectionState == BarcodeManager.ConnectionState.Connected)
                {
                    // Bluetooth scanner connected

                    // Restore continuous mode flag
                    isContinuousMode = isContinuousModeSaved;

                    // Initialize scanner
                    InitScanner();
                    SetTrigger();
                    SetDecoders();
                }

                if (connectionState == BarcodeManager.ConnectionState.Disconnected)
                {
                    // Bluetooth scanner disconnected

                    // Save the current state of continuous mode flag
                    isContinuousModeSaved = isContinuousMode;

                    // Reset continuous flag
                    isContinuousMode = false;

                    // De-initialize scanner
                    DeInitScanner();

                    // Enable UI Controls
                    RunOnUiThread(() => EnableUIControls(true));
                }
            }
            else
            {
                status = "Status: " + statusString + " " + scannerNameBT + ":" + statusBT;
                RunOnUiThread(() => textViewStatus.Text = status);
            }
        }
        private void BarcodeManager_Connection(object sender, BarcodeManager.ScannerConnectionEventArgs e)
        {
            ScannerInfo scannerInfo = e.P0;

            BarcodeManager.ConnectionState connectionState = e.P1;

            string statusBT      = connectionState.ToString();
            string scannerNameBT = scannerInfo.FriendlyName;
        }
        private void barcodeManager_Connection(object sender, BarcodeManager.ScannerConnectionEventArgs e)
        {
            string status;
            string scannerName = "";

            ScannerInfo scannerInfo = e.P0;

            BarcodeManager.ConnectionState connectionState = e.P1;

            string statusBT      = connectionState.ToString();
            string scannerNameBT = scannerInfo.FriendlyName;



            if (deviceList.Count != 0)
            {
                scannerName = deviceList[scannerIndex].FriendlyName;
            }

            if (scannerName.ToLower().Equals(scannerNameBT.ToLower()))
            {
                status = "Status: " + scannerNameBT + ":" + statusBT;
                RunOnUiThread(() => textViewStatus.Text = status);

                if (connectionState == BarcodeManager.ConnectionState.Connected)
                {
                    DeInitScanner();
                    InitScanner();
                    SetTrigger();
                    SetConfig();
                }

                if (connectionState == BarcodeManager.ConnectionState.Disconnected)
                {
                    // De-initialize scanner
                    DeInitScanner();
                }
                status = "Status: " + scannerNameBT + ":" + statusBT;
                RunOnUiThread(() => textViewStatus.Text = status);
            }
            else
            {
                status = "Status: " + statusString + " " + scannerNameBT + ":" + statusBT;
                RunOnUiThread(() => textViewStatus.Text = status);
            }
        }
示例#4
0
        void barcodeManager_Connection(object sender, BarcodeManager.ScannerConnectionEventArgs e)
        {
            String status;
            String scannerName = "";

            ScannerInfo scannerInfo = e.P0;

            BarcodeManager.ConnectionState connectionState = e.P1;

            String statusBT      = connectionState.ToString();
            String scannerNameBT = scannerInfo.FriendlyName;

            if (scannerList.Count != 0)
            {
                scannerName = scannerList[scannerIndex].FriendlyName;
            }

            if (scannerName.ToLower().Equals(scannerNameBT.ToLower()))
            {
                status = "Status: " + scannerNameBT + ":" + statusBT;
                RunOnUiThread(() => textViewStatus.Text = status);

                if (connectionState == BarcodeManager.ConnectionState.Connected)
                {
                    // Bluetooth scanner connected
                    initScanner();
                    setTrigger();
                    setDecoders();
                }

                if (connectionState == BarcodeManager.ConnectionState.Disconnected)
                {
                    // Bluetooth scanner disconnected
                    deInitScanner();
                    RunOnUiThread(() => EnableUIControls(true));
                }
            }
            else
            {
                status = "Status: " + statusString + " " + scannerNameBT + ":" + statusBT;
                RunOnUiThread(() => textViewStatus.Text = status);
            }
        }