internal void DownloadDataCompleted(object sender, DownloadDataCompletedEventArgsWrapper e, Func<string, string> processResponseString, Action<object, FacebookApiEventArgs> onDownloadComplete)
{
Contract.Requires(onDownloadComplete != null);
// var userState = (WebClientStateContainer)e.UserState;
string json = null;
if (e.Error == null && e.Result != null)
{
json = Encoding.UTF8.GetString(e.Result, 0, e.Result.Length);
if (processResponseString != null)
{
// make the result json
json = processResponseString(json);
}
}
HttpMethod method;
var args = GetApiEventArgs(e, json, out method);
/*
* use onDownloadComplete instead, so don't need to do string compare
if (userState.RequestUri.AbsolutePath.StartsWith("/oauth/access_token") && GetApplicationAccessTokenCompleted != null)
{
GetApplicationAccessTokenCompleted(this, args);
}
*/
onDownloadComplete(this, args);
}