コード例 #1
0
 private void _bluetoothService_NewDateRecieved(object _sender, BLEModel _bleModel)
 {
     Application.Current.Dispatcher?.Invoke(() =>
     {
         Data.Add(_bleModel);
     }, DispatcherPriority.Normal);
 }
コード例 #2
0
 private void BluetoothService_NewDateRecieved(object _sender, BLEModel _bleModel)
 {
     Data.Add(_bleModel);
     if (!Manufacturers.ToList().Any(x => x.ManufacturerID == _bleModel.Manufacturer.ManufacturerID))
     {
         Manufacturers.Add(_bleModel.Manufacturer);
     }
 }
コード例 #3
0
        private void Watcher_Received(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)
        {
            var manufacturerDataCollection = args.Advertisement.ManufacturerData.ToList();

            foreach (var item in manufacturerDataCollection)
            {
                var result = new BLEModel();
                result.Manufacturer = new ManufacturerData()
                {
                    ManufacturerID = item.CompanyId
                };
                result.Data = ReadBuffer(item.Data);
                result.ID   = args.BluetoothAddress;
                NewDateRecieved?.Invoke(this, result);
            }
        }
コード例 #4
0
ファイル: MainViewModel.cs プロジェクト: 6demon89/Tutorials
        private void Watcher_Received(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)
        {
            var manufacturerDataCollection = args.Advertisement.ManufacturerData.ToList();

            foreach (var item in manufacturerDataCollection)
            {
                var result = new BLEModel();
                result.Company = item.CompanyId;
                result.Data    = ReadBuffer(item.Data);
                result.ID      = args.BluetoothAddress;

                Application.Current.Dispatcher.Invoke(() =>
                {
                    bag.Add(result);
                }, DispatcherPriority.Normal);
            }
        }