Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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