Created
August 30, 2016 15:13
-
-
Save thnee/aeff7afc5ccc2e2fe9911f342141bdb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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