private async void BluetoothLEHelper_EnumerationCompleted(object sender, EventArgs e)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         bluetoothLEHelper.StopEnumeration();
         BtEnumeration.Content = "Start Enumerating";
     });
 }
Example #2
0
        public void Stop()
        {
            if (state == BLEScannerState.DISABLED)
            {
                Logger.Warn("Unable to stop Bluetooth scanner. Already stopped!");
                return;
            }

            if (state == BLEScannerState.SCANNING)
            {
                BLE_HELPER.StopEnumeration();
            }

            BLE_HELPER.EnumerationCompleted -= BLE_HELPER_EnumerationCompleted;
            BLE_HELPER.BluetoothLeDevices.CollectionChanged -= BluetoothLeDevices_CollectionChanged;

            SetState(BLEScannerState.DISABLED);
            Logger.Info("Bluetooth scanner stopped.");
        }
 private void UserControl_Unloaded(object sender, RoutedEventArgs e)
 {
     bluetoothLEHelper.StopEnumeration();
 }