示例#1
0
 public BluetoothSetupViewModel(IBluetoothService bluetoothService, IBluetoothProfileActivator bluetoothProfileActivator, ISchedulerProvider schedulerProvider)
 {
     _bluetoothService          = bluetoothService;
     _bluetoothProfileActivator = bluetoothProfileActivator;
     _schedulerProvider         = schedulerProvider;
     _roDevices             = new ReadOnlyObservableCollection <IBluetoothDevice>(_devices);
     _scanForDevicesCommand = new DelegateCommand(ScanForDevices, CanScanForDevices);
     _status = ViewModelStatus.Error(Resources.Bluetooth_NoDevices_RequiresScan);
     _bluetoothProfileActivator.PropertyChanges(bs => bs.IsEnabled)
     .Subscribe(_ =>
     {
         OnPropertyChanged("IsEnabled");
         _scanForDevicesCommand.RaiseCanExecuteChanged();
     });
 }
 public BluetoothSetupViewModel(IBluetoothService bluetoothService, IBluetoothProfileActivator bluetoothProfileActivator, ISchedulerProvider schedulerProvider)
 {
     _bluetoothService = bluetoothService;
     _bluetoothProfileActivator = bluetoothProfileActivator;
     _schedulerProvider = schedulerProvider;
     _roDevices = new ReadOnlyObservableCollection<IBluetoothDevice>(_devices);
     _scanForDevicesCommand = new DelegateCommand(ScanForDevices, CanScanForDevices);
     _status = ViewModelStatus.Error(Resources.Bluetooth_NoDevices_RequiresScan);
     _bluetoothProfileActivator.PropertyChanges(bs => bs.IsEnabled)
                      .Subscribe(_ =>
                                     {
                                         OnPropertyChanged("IsEnabled");
                                         _scanForDevicesCommand.RaiseCanExecuteChanged();
                                     });               
                          
 }