Ejemplo n.º 1
0
 private void ScanForDevices()
 {
     _devices.Clear();
     Status = ViewModelStatus.Processing;
     _bluetoothService.ScanForDevices()
     .SubscribeOn(_schedulerProvider.Concurrent)
     .ObserveOn(_schedulerProvider.Dispatcher)
     .Subscribe(
         device => _devices.Add(device),
         ex => { Status = ViewModelStatus.Error(ex.Message); },
         () =>
     {
         Status = _devices.Any()
                         ? ViewModelStatus.Idle
                         : ViewModelStatus.Error(Resources.Bluetooth_NoDevicesFound);
     });
 }