public DeviceListingViewModel(IBluetoothDeviceLister deviceLister, Action <IBluetoothDevice> connectCallback) { _deviceLister = deviceLister; ConnectCommand = new Command( para => connectCallback(SelectedDevice.Value), canExecute => SelectedDevice.Value != null ); SelectedDevice = new NotifyingProperty <IBluetoothDevice>(dependentCommand: ConnectCommand); foreach (var device in _deviceLister.GetPairedDevices()) { PairedDevices.Add(device); } }
public MainViewModel() { _deviceLister = DependencyService.Get <IBluetoothDeviceLister>(); ActiveViewModel.Value = new DeviceListingViewModel(_deviceLister, Connect); }