/// <summary> /// Resets all. /// </summary> /// <param name="message">The message.</param> private void ResetAll(Message message) { if (!message.IsToShowDevices) { if (_receiverBluetoothService.WasStarted) { _receiverBluetoothService.Stop(); } IsListening = false; Data = "N/D"; Status = "N/D"; } }
/// <summary> /// Initializes a new instance of the <see cref="ReceiverViewModel" /> class. /// </summary> /// <param name="receiverBluetoothService">The Receiver bluetooth service.</param> public ReceiverViewModel(IReceiverBluetoothService receiverBluetoothService) { _receiverBluetoothService = receiverBluetoothService; _receiverBluetoothService.PropertyChanged += ReceiverBluetoothService_PropertyChanged; IsStarEnabled = true; Data = "N/D"; Status = "N/D"; StartCommand = new RelayCommand(() => { _receiverBluetoothService.Start(SetData); IsStarEnabled = false; Data = "Can receive data."; }); StopCommand = new RelayCommand(() => { _receiverBluetoothService.Stop(); IsStarEnabled = true; Data = "Cannot receive data."; }); Messenger.Default.Register<Message>(this, ResetAll); }
/// <summary> /// Initializes a new instance of the <see cref="ReceiverViewModel" /> class. /// </summary> /// <param name="receiverBluetoothService">The Receiver bluetooth service.</param> public ReceiverViewModel(IReceiverBluetoothService receiverBluetoothService) { _receiverBluetoothService = receiverBluetoothService; _receiverBluetoothService.PropertyChanged += ReceiverBluetoothService_PropertyChanged; IsStarEnabled = true; Data = "N/D"; Status = "N/D"; StartCommand = new RelayCommand(() => { _receiverBluetoothService.Start(SetData); IsStarEnabled = false; Data = "Can receive data."; }); StopCommand = new RelayCommand(() => { _receiverBluetoothService.Stop(); IsStarEnabled = true; Data = "Cannot receive data."; }); Messenger.Default.Register <Message>(this, ResetAll); }