Skip to content

Instantly share code, notes, and snippets.

@ztirom
Created April 22, 2016 16:50
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 ztirom/e3498287cf6369e66535676a72dc77cb to your computer and use it in GitHub Desktop.
Save ztirom/e3498287cf6369e66535676a72dc77cb to your computer and use it in GitHub Desktop.
First steps with Xamarin and the Microsoft Band SDK
[Activity(Label = "Hello World Band Android", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity {
protected override void OnCreate(Bundle bundle) {
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Button button = FindViewById<button>(Resource.Id.MyButton);
SetupBand();
button.Click += delegate
{
if (myBand != null && myBand.BandClient.IsConnected)
button.Text = string.Format("Connected to {0}!", myBand.Name);
else
Toast.MakeText(this, "Band not yet connected or not found!", ToastLength.Long);
};
}
private async void SetupBand() {
// get instance
myBand = Band.Instance;
await myBand.PairBand();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment