private void DoRequestCallback(RestRequest rrqRequest, RestResponse rrsResponse, object objUserState) { RestResponseHash rrhResponse = new RestResponseHash(rrsResponse); APIReturn aprReturn = (APIReturn)objUserState; OAuthCredentials oaCredentials = (OAuthCredentials)aprReturn.CallbackArg; string sErrorMessage = ""; if (rrsResponse.InnerException != null) sErrorMessage = rrsResponse.InnerException.Message; APICallbackArgs acArgs = new APICallbackArgs(rrsResponse.StatusCode == HttpStatusCode.OK, sErrorMessage, new OAuthResponseObject(rrhResponse, oaCredentials)); aprReturn.SynchronizeInvoke(new object[] { acArgs }); }
private void GetRequestTokenCallback(APICallbackArgs acArgs) { if (RequestTokenReceived != null) { OAuthResponseObject oroResponse = (OAuthResponseObject)acArgs.ResponseObject; if (acArgs.Succeeded) { if (oroResponse.Response.ContainsKey("oauth_token") && oroResponse.Response.ContainsKey("oauth_token_secret")) { oroResponse.Credentials.Token = oroResponse.Response["oauth_token"]; oroResponse.Credentials.TokenSecret = oroResponse.Response["oauth_token_secret"]; APIReturn.SynchronizeInvoke(RequestTokenReceived, new object[4] { this, true, "", oroResponse.Credentials }); } else APIReturn.SynchronizeInvoke(RequestTokenReceived, new object[4] { this, false, "An error occurred retrieving a request token from Twitter. Please try again.", null }); } else APIReturn.SynchronizeInvoke(RequestTokenReceived, new object[4] { this, false, acArgs.ErrorMessage, null }); } }
private void UserLookupCallback(APICallbackArgs acArgs) { //make a dummy status, give it the user object we have m_stStatusObj.RetweetedStatus = new Status(new Json.JsonNode()); m_stStatusObj.RetweetedStatus.User = ((List<User>)acArgs.ResponseObject)[0]; AsyncContentManager.GetManager().RequestImage(m_stStatusObj.RetweetedStatus.User["profile_image_url"].ToString(), AvatarCallback); }
private void GetAccessTokenCallback(APICallbackArgs acArgs) { if (AccessTokenReceived != null) { OAuthResponseObject oroResponse = (OAuthResponseObject)acArgs.ResponseObject; if (acArgs.Succeeded) { if (oroResponse.Response.ContainsKey("oauth_token") && oroResponse.Response.ContainsKey("oauth_token_secret")) { oroResponse.Credentials.Token = oroResponse.Response["oauth_token"]; oroResponse.Credentials.TokenSecret = oroResponse.Response["oauth_token_secret"]; oroResponse.Credentials.ClientUsername = oroResponse.Response["screen_name"]; APIReturn.SynchronizeInvoke(AccessTokenReceived, new object[4] { this, true, "", oroResponse.Credentials }); } else APIReturn.SynchronizeInvoke(AccessTokenReceived, new object[4] { this, false, "An error occurred authenticating with the pin you supplied. Please try again with the correct pin.", null }); } else APIReturn.SynchronizeInvoke(AccessTokenReceived, new object[4] { this, false, acArgs.ErrorMessage, null }); } }
private void FavoriteDestroyCallback(APICallbackArgs acArgs) { CallbackCheckSucceeded("There was an error un-favoriting that tweet.", "Un-favorite Error", acArgs); }
private void FavoriteCreateCallback(APICallbackArgs acArgs) { CallbackCheckSucceeded("There was an error favoriting that tweet.", "Favorite Error", acArgs); }
private void RetweetCallback(APICallbackArgs acArgs) { CallbackCheckSucceeded("There was an error posting your retweet.", "Retweet Error", acArgs); }
private void UpdateStatusCallback(APICallbackArgs acArgs) { CallbackCheckSucceeded("There was an error posting your tweet.", "Tweet Error", acArgs); }
protected void CallbackCheckSucceeded(string sMessage, string sTitle, APICallbackArgs acArgs) { if (!acArgs.Succeeded) MessageBox.Show(sMessage + "\n\nTwitter said: \"" + acArgs.ErrorMessage + "\"", sTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }