Esempio n. 1
0
        private void LoadPicker()
        {
            isPickerActive = true;

            if (oBlueToothCmds_Picker == null)
            {
                oBlueToothCmds_Picker = new BlueToothCmds();
            }

            oBlueToothCmds_Picker.Clear();

            try
            {
                // ToDo: Load from db

                oBlueToothCmds_Picker.CreateTestCommands(oUserSetting.GetUserUnits(), false);
                oBlueToothCmds_Picker.RemoveAll(x => x.isSelected);
                pkrProcess.ItemsSource  = oBlueToothCmds_Picker;
                pkrProcess.IsEnabled    = true;
                pkrProcess.IsVisible    = true;
                pkrProcess.SelectedItem = null;
                pkrProcess.Focus();
            }
            catch (Exception ex)
            {
                DisplayMessage(ex.Message);
                isPickerActive = false;
            }
        }
Esempio n. 2
0
        private async void OpenBluetooth(string name, string address, bool isTest)
        {
            //oBluetooth = null;
            //oBluetooth = new Bluetooth(true, isTest); // Create connection object

            if (!oBluetooth.isTestMode())
            {
                if (!Bluetooth.CheckAdapterPresent()) // Check if bluetooth is available on this device: display message and return on failure
                {
                    ProcessConnectionError(ERROR_TYPE.ADAPTER_ERROR);
                    return;
                }

                if (!Bluetooth.CheckAdapterEnabled()) // Check if bluetooth is enabled on this device: display message and return on failure
                {
                    ProcessConnectionError(ERROR_TYPE.ADAPTER_DISABLED);
                    return;
                }

                if (!oBluetooth.LoadPairedDevices()) // Attempt to load paired devices: display message and return on failure
                {
                    ProcessConnectionError(ERROR_TYPE.PAIR_ERROR);
                    return;
                }

                if (!oBluetooth.CheckPairedDevices()) // Check if there are paired devices available: display message and return on failure
                {
                    ProcessConnectionError(ERROR_TYPE.PAIR_NONE);
                    return;
                }

                if (!await oBluetooth.OpenPairedDevice(name, address, true)) // Attempt to open paired device: if failed get list of paired devices
                {
                    ProcessConnectionError(ERROR_TYPE.PAIR_FAILED);
                    return;
                }
            }

            // Load some test commands and run processing loop

            oBlueToothCmds = null;
            oBlueToothCmds = new BlueToothCmds();

            // ToDo: replace with db values
            oBlueToothCmds.CreateTestCommands(oUserSetting.GetUserUnits(), true);

            InitListViewItems(oBlueToothCmds);
            RunProcesses();
        }