Skip to content

Instantly share code, notes, and snippets.

@rmenezes
Last active January 14, 2016 23:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmenezes/d1a98e18f19c6555c6c2 to your computer and use it in GitHub Desktop.
Save rmenezes/d1a98e18f19c6555c6c2 to your computer and use it in GitHub Desktop.
FacebookCallBack Sample for Xamarin.Android
using System;
using Xamarin.Facebook;
using CupcakeStore.Android.Activities;
using Xamarin.Facebook.Login;
using Android.Runtime;
namespace CupcakeStore.Android
{
public class FacebookCallback<TResult> : Java.Lang.Object, IFacebookCallback
where TResult : Java.Lang.Object
{
public Action HandleCancel { get; set; }
public Action<FacebookException> HandleError { get; set; }
public Action<TResult> HandleSuccess { get; set; }
public FacebookCallback ()
{
}
public void OnCancel ()
{
var handle = HandleCancel;
if (handle != null)
handle ();
}
public void OnError (FacebookException error)
{
var handle = HandleError;
if (handle != null)
handle (error);
}
public void OnSuccess (Java.Lang.Object result)
{
var handle = HandleSuccess;
if (handle != null)
handle (result.JavaCast<TResult> ());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment