Skip to content

Instantly share code, notes, and snippets.

@thnee
Created August 30, 2016 15:13
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 thnee/aeff7afc5ccc2e2fe9911f342141bdb8 to your computer and use it in GitHub Desktop.
Save thnee/aeff7afc5ccc2e2fe9911f342141bdb8 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Plugin.BLE.Abstractions.Contracts;
using Xamarin.Forms;
// the goal is to get result of device.GetServicesAsync() into this.services
namespace ClickCount {
public partial class ServiceListPage : ContentPage {
ObservableCollection<IService> services = new ObservableCollection<IService>();
public ServiceListPage(IDevice device) {
InitializeComponent();
ServiceList.ItemsSource = services;
GetServices(device); // raises warning
}
private async Task GetServices(IDevice device) {
services = new ObservableCollection<IService>(await device.GetServicesAsync());
Console.WriteLine("## Got services::::");
Console.WriteLine(services);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment