private void _bluetoothService_NewDateRecieved(object _sender, BLEModel _bleModel) { Application.Current.Dispatcher?.Invoke(() => { Data.Add(_bleModel); }, DispatcherPriority.Normal); }
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); } }
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); } }
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); } }