Skip to content

Instantly share code, notes, and snippets.

@houwasystemdesign
Created December 12, 2019 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save houwasystemdesign/ad663cb3b30a9eedc918aaf2adfcc736 to your computer and use it in GitHub Desktop.
Save houwasystemdesign/ad663cb3b30a9eedc918aaf2adfcc736 to your computer and use it in GitHub Desktop.
private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher watcher,
BluetoothLEAdvertisementReceivedEventArgs eventArgs)
{
//アドバタイズ受信した際の処理
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
//同要素がなければListに追加
AdvertisementListItem item = new AdvertisementListItem(eventArgs);
if (AdvertisementList.Select(x => x.BluetoothAddress).Where(x => x.Equals(item.BluetoothAddress)).Count() == 0)
{
AdvertisementList.Add(item);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment