void RFBClient_PostCompleted(object sender, FacebookApiEventArgs e) { RFBClient.PostCompleted -= new EventHandler <FacebookApiEventArgs>(RFBClient_PostCompleted); if (e.Error == null) { #if !DEBUG Stopwatch OStop = new Stopwatch(); Console.WriteLine("Friends Fetching Started .."); OStop.Start(); #endif var result = (IDictionary <string, object>)e.GetResultData(); //if (Verifier.Verify(ResultsObject, "data")) // ResultsArray = ResultsObject["data"] as JsonArray; var id = result["id"] as string; OnNewEventCreated(id); #if !DEBUG Console.WriteLine("Friends Fetching Finished in " + OStop.ElapsedMilliseconds); OStop.Stop(); #endif //FinishedEvents.NotifyFriendsDataFinished(true, FriendList); } else { //FinishedEvents.NotifyFriendsDataFinished(false, null); } }
private static void HandleGetCompleted(object sender, FacebookApiEventArgs e) { var callback = e.UserState as FacebookDelegate; if (callback != null) { var result = new FBResult(); if (e.Cancelled) { result.Error = "Cancelled"; } else if (e.Error != null) { result.Error = e.Error.Message; } else { var obj = e.GetResultData(); result.Text = obj.ToString(); result.Json = obj as JsonObject; } Utils.RunOnUnityAppThread(() => { callback(result); }); } }
void client_GetCompleted(object sender, FacebookApiEventArgs e) { if (e.Error != null) { Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message)); return; } else { //SocialAccount account = new SocialAccount( //var result = (IDictionary<string, object>)e.GetResultData(); //var id = (string)result["id"]; FBUser userAccount = JsonConvert.DeserializeObject <FBUser>(e.GetResultData().ToString()); SocialAccount socialAccount = new SocialAccount(userAccount.id, client.AccessToken, userAccount.username, null); SettingHelper.SetKeyValue <SocialAccount>("SocialAccount", socialAccount); Dispatcher.BeginInvoke(() => { FacebookWebBrowser.Visibility = System.Windows.Visibility.Collapsed; StackPanelHeader.Visibility = System.Windows.Visibility.Visible; ContentPanel.Visibility = System.Windows.Visibility.Visible; }); } }
// アクセストークンを取得 void oauthClient_ExchangeCodeForAccessTokenCompleted(object sender, FacebookApiEventArgs e) { var result = e.GetResultData() as IDictionary <string, object>; if (result == null) { return; } accessToken = (string)result["access_token"]; Dispatcher.BeginInvoke(() => { textAccessToken.Text = accessToken; }); }
private void OnGetFriendsCompleted(object sender, FacebookApiEventArgs e) { RFBClient.GetCompleted -= new EventHandler <FacebookApiEventArgs>(OnGetFriendsCompleted); if (e.Error == null) { #if !DEBUG Stopwatch OStop = new Stopwatch(); Console.WriteLine("Friends Fetching Started .."); OStop.Start(); #endif var result = (IDictionary <string, object>)e.GetResultData(); //JsonArray ResultsArray = null; //JsonObject ResultsObject = e.GetResultData() as JsonObject; ObservableCollection <ProfileInfo> FriendList = new ObservableCollection <ProfileInfo>(); List <string> ids = new List <string>(); //if (Verifier.Verify(ResultsObject, "data")) // ResultsArray = ResultsObject["data"] as JsonArray; var dataItem = (JsonArray)result["data"]; foreach (JsonObject item in dataItem) { FriendList.Add(new ProfileInfo(item)); } foreach (var item in FriendList) { ids.Add(item.ID); } OnFriendListUpdated(FriendList); #if !DEBUG Console.WriteLine("Friends Fetching Finished in " + OStop.ElapsedMilliseconds); OStop.Stop(); #endif App.MManager.PublishMessageByType <FriendListMessage>(new FriendListMessage() { FriendIDList = ids }); } else { } }
private void fb_PostCompleted(object sender, FacebookApiEventArgs e) { if (e.Cancelled) { var cancellationError = e.Error; MessageBox.Show("Upload unterbrochen"); } else if (e.Error == null) { // upload successful. MessageBox.Show(e.GetResultData().ToString()); } else { // upload failed MessageBox.Show(e.Error.Message); } }
public void fb_PostCompleted(object sender, FacebookApiEventArgs e) { if (e.Cancelled) { MessageBox.Show("Upload cancelled"); } else if (e.Error == null) { // upload successful. MessageBox.Show(e.GetResultData().ToString()); } else { // upload failed MessageBox.Show(e.Error.Message); } progressBar1.BeginInvoke(new MethodInvoker(() => { progressBar1.Value = 0; })); }
public void fb_PostCompleted(object sender, FacebookApiEventArgs e) { btnUpload.Tag = 0; picStatus.Visible = false; btnUpload.Text = GlobalSetting.LangPack.Items["frmFacebook.btnUpload._Upload"]; if (e.Cancelled) { lblStatus.Text = GlobalSetting.LangPack.Items["frmFacebook._StatusCancel"]; } else if (e.Error == null) { // upload successful. lblStatus.Text = GlobalSetting.LangPack.Items["frmFacebook._StatusSuccessful"]; btnUpload.Tag = ((IDictionary <string, object>)e.GetResultData())["id"].ToString(); //Get Post ID btnUpload.Text = GlobalSetting.LangPack.Items["frmFacebook.btnUpload._ViewImage"]; } else { // upload failed lblStatus.Text = e.Error.Message; } }
private void OnGetEventsCompleted(object sender, FacebookApiEventArgs e) { RFBClient.GetCompleted -= new EventHandler <FacebookApiEventArgs>(OnGetEventsCompleted); if (e.Error == null) { #if !DEBUG Stopwatch OStop = new Stopwatch(); Console.WriteLine("Friends Fetching Started .."); OStop.Start(); #endif var result = (IDictionary <string, object>)e.GetResultData(); ObservableCollection <Event> FriendList = new ObservableCollection <Event>(); //if (Verifier.Verify(ResultsObject, "data")) // ResultsArray = ResultsObject["data"] as JsonArray; var dataItem = (JsonArray)result["data"]; foreach (JsonObject item in dataItem) { FriendList.Add(new Event(item)); } OnEventListUpdated(FriendList); #if !DEBUG Console.WriteLine("Friends Fetching Finished in " + OStop.ElapsedMilliseconds); OStop.Stop(); #endif //FinishedEvents.NotifyFriendsDataFinished(true, FriendList); } else { //FinishedEvents.NotifyFriendsDataFinished(false, null); } }