コード例 #1
0
 /// <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";
     }
 }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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);
        }