protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.main);
textRegistrationStatus = FindViewById<TextView>(Resource.Id.textRegistrationStatus);
textRegistrationId = FindViewById<TextView>(Resource.Id.textRegistrationId);
textLastMsg = FindViewById<TextView>(Resource.Id.textLastMessage);
buttonRegister = FindViewById<Button>(Resource.Id.buttonRegister);
Log.Info("C2DM-Sharp-UI", "Hello World");
this.buttonRegister.Click += delegate
{
if (!registered)
{
Log.Info("C2DM-Sharp", "Registering...");
C2dmSharp.Client.C2dmClient.Register(this, senderIdEmail);
}
else
{
Log.Info("C2DM-Sharp", "Unregistering...");
C2dmSharp.Client.C2dmClient.Unregister(this);
}
RunOnUiThread(() =>
{
//Disable the button so that we can't click it again
//until we get back to the activity from a notification
this.buttonRegister.Enabled = false;
});
};
}