Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SenderViewModel"/> class.
        /// </summary>
        /// <param name="senderBluetoothService">
        /// The Sender bluetooth service.
        /// </param>
        ///

        public SenderViewModel(ISenderBluetoothService senderBluetoothService)
        {
            _senderBluetoothService = senderBluetoothService;
            ResultValue             = "N/D";
            SendCommand             = new RelayCommand(
                SendData,
                () => !string.IsNullOrEmpty(Data) && SelectDevice != null && SelectDevice.DeviceInfo != null);
            ConnectDevice = new RelayCommand(
                ConnectBlue,
                () => SelectDevice != null);
            Devices = new ObservableCollection <Device>
            {
                new Device(null)
                {
                    DeviceName = "Searching..."
                }
            };
            Messenger.Default.Register <Message>(this, ShowDevice);

            //Start thread to keep cheking the connection status
            Thread trDevConnection = new Thread(CheckDeviceConnection)
            {
                IsBackground = true
            };

            trDevConnection.Start();
        }
Ejemplo n.º 2
0
        public SendPage()
        {
            ISenderBluetoothService service   = DependencyService.Get <ISenderBluetoothService>();
            SendViewModel           viewModel = new SendViewModel(service);

            this.BindingContext = viewModel;
            InitializeComponent();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SenderViewModel"/> class.
 /// </summary>
 /// <param name="senderBluetoothService">
 /// The Sender bluetooth service.
 /// </param>
 public SenderViewModel(ISenderBluetoothService senderBluetoothService)
 {
     _senderBluetoothService = senderBluetoothService;
     ResultValue = "N/D";
     SendCommand = new RelayCommand(
         SendData,
         () => !string.IsNullOrEmpty(Data) && SelectDevice != null && SelectDevice.DeviceInfo != null);
     Devices = new ObservableCollection<Device>
     {
         new Device(null) { DeviceName = "Searching..." }
     };
     Messenger.Default.Register<Message>(this, ShowDevice);
 }
Ejemplo n.º 4
0
 public SendViewModel(ISenderBluetoothService senderBluetoothService)
 {
     Title = "Send";
     _senderBluetoothService = senderBluetoothService;
     ResultValue             = "N/D";
     Devices = new ObservableCollection <Device>
     {
         new Device(null)
         {
             DeviceName = "Searching..."
         }
     };
     Messenger.Default.Register <Message>(this, ShowDevice);
 }
Ejemplo n.º 5
0
        public MainViewModel(
            [NotNull] ISenderBluetoothService service,
            [NotNull] IUser32 user32,
            [NotNull] ILog log)
        {
            _service = service;
            _user32  = user32;
            _log     = log;

            WatchCommand       = new RelayCommand(ExecuteWatch);
            RemoveWatchCommand = new RelayCommand(ExecuteRemoveWatch);

            StartDiscoverTask();
            StartScanning();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SenderViewModel"/> class.
 /// </summary>
 /// <param name="senderBluetoothService">
 /// The Sender bluetooth service.
 /// </param>
 public SenderViewModel(ISenderBluetoothService senderBluetoothService)
 {
     _senderBluetoothService = senderBluetoothService;
     ResultValue             = "N/D";
     SendCommand             = new RelayCommand(
         SendData,
         () => !string.IsNullOrEmpty(Data) && SelectDevice != null && SelectDevice.DeviceInfo != null);
     Devices = new ObservableCollection <Device>
     {
         new Device(null)
         {
             DeviceName = "Searching..."
         }
     };
     Messenger.Default.Register <Message>(this, ShowDevice);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SenderViewModel"/> class.
        /// </summary>
        /// <param name="senderBluetoothService">
        /// The Sender bluetooth service.
        /// </param>
        /// 

        public SenderViewModel(ISenderBluetoothService senderBluetoothService)
        {
           
            _senderBluetoothService = senderBluetoothService;
            ResultValue = "N/D";
            SendCommand = new RelayCommand(
                SendData,
                () => !string.IsNullOrEmpty(Data) && SelectDevice != null && SelectDevice.DeviceInfo != null );
            ConnectDevice = new RelayCommand(
              ConnectBlue,
              () => SelectDevice != null);
            Devices = new ObservableCollection<Device>
            {
                new Device(null) { DeviceName = "Searching..." }
            };
            Messenger.Default.Register<Message>(this, ShowDevice);

            //Start thread to keep cheking the connection status
            Thread trDevConnection = new Thread(CheckDeviceConnection) { IsBackground = true }; 
            trDevConnection.Start();
            
        }
 public AsynchronousSocketListener()
 {
     service = new SenderBluetoothService();
     devices = new List <Device>();
 }