private void PublishBlogCompletedCallBack(object sender, APIRequestCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         try
         {
             //获取blog的id
             BlogID blogId = new BlogID();
             blogId = (BlogID)JsonUtility.DeserializeObj(
                 new MemoryStream(Encoding.UTF8.GetBytes(e.ResultJsonString)), typeof(BlogID));
             MessageBox.Show("创建成功");
             tb_result.Text = "id: " + blogId.id;
         }
         catch
         {
             MessageBox.Show("encoding error");
         }
     }
     else
         MessageBox.Show(e.Error.Message);
 }
예제 #2
0
 private void RenrenAddCommentGetCallback(object sender, APIRequestCompletedEventArgs e)
 {
     // Success
     if (e.Error == null)
     {
         DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(RenrenAddCommentResult));
         RenrenAddCommentResult addCommentsResult = serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(e.ResultJsonString))) as RenrenAddCommentResult;
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             if (addCommentsResult.result == RenrenAddCommentResult.SUCCESS)
             {
                 MessageBox.Show("发送成功!");
                 // go back to CommentView.
                 // CommentView should refresh itself to show the newly added comment
                 NavigationService.GoBack();
             }
         });
     }
     // Fail
     else
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show("发送失败!");
             // go back to CommentView.
             // CommentView should refresh itself to show the newly added comment
             NavigationService.GoBack();
         });
     }
 }
예제 #3
0
        private void SearchCallback(object sender, APIRequestCompletedEventArgs e)
        {
            try
            {
                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(RenrenSearchedManResult));
                RenrenSearchedManResult searchResult = serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(e.ResultJsonString))) as RenrenSearchedManResult;

                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    m_progressIndicatorHelper.PopTask();
                    SearchResult.Clear();
                    if (searchResult != null && searchResult.friends != null)
                        foreach (RenrenSearchedMan friend in searchResult.friends)
                        {
                            //App.ViewModel.Friends.Add(friend);

                            SearchResult.Add(friend);
                        }
                    ScrollViewer v = VisualTreeHelper.GetChild(this.ResultListBox, 0) as ScrollViewer;
                    v.ScrollToVerticalOffset(0);
                });
            }
            catch (System.Exception ex)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    m_progressIndicatorHelper.PopTask();
                });
            }
        }
예제 #4
0
 private void RenrenUphotStatus_DownloadStringCompleted(object sender, APIRequestCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show(e.Error.Message);
         });
     }
     else
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             MessageBox.Show("发送成功");
         });
     }
 }
예제 #5
0
 private void RenrenShareCommentGetCallback(object sender, APIRequestCompletedEventArgs e)
 {
     // Success
     if (e.Error == null)
     {
         DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(RenrenShareGetCommentsResult));
         RenrenShareGetCommentsResult commentsResult = serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(e.ResultJsonString))) as RenrenShareGetCommentsResult;
         if (commentsResult != null && commentsResult.comments != null)
         {
             Deployment.Current.Dispatcher.BeginInvoke(() =>
             {
                 Comments.Clear();
                 List<CommentViewModel> sortList = new List<CommentViewModel>();
                 foreach (RenrenShareGetCommentsResult.Comment comment in commentsResult.comments)
                 {
                     CommentViewModel model = RenrenModelConverter.ConvertShareCommentToCommon(comment);
                     if (model != null)
                         sortList.Add(model);
                 }
                 var sorted = from m in sortList orderby m.TimeObject descending select m;
                 if (sorted != null)
                 {
                     foreach (CommentViewModel model in sorted)
                     {
                         Comments.Add(model);
                     }
                 }
                 UpdateCommentCount(Comments.Count);
                 AddEmptyTipCommentCleverly();
             });
         }
     }
     // Fail
     else
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             if (!String.IsNullOrEmpty(PreferenceHelper.GetPreference("Renren_ID")))
             {
                 MessageBox.Show("人人评论获取失败,可能是网络问题,也可能是帐号过期", "失败", MessageBoxButton.OK);
             }
         });
     }
 }
예제 #6
0
 private void RenrenCommentGetCallback(object sender, APIRequestCompletedEventArgs e)
 {
     // Success
     if (e.Error == null)
     {
         DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List<RenrenNews.Comments.Comment>));
         List<RenrenNews.Comments.Comment> commentsResult = serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(e.ResultJsonString))) as List<RenrenNews.Comments.Comment>;
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             Comments.Clear();
             commentsResult.ForEach(p =>
             {
                 CommentViewModel model = RenrenModelConverter.ConvertCommentToCommon(p);
                 if (model != null)
                 {
                     Comments.Add(model);
                 }
             });
             UpdateCommentCount(Comments.Count);
             AddEmptyTipCommentCleverly();
         });
     }
     // Fail
     else
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             if (!String.IsNullOrEmpty(PreferenceHelper.GetPreference("Renren_ID")))
             {
                 MessageBox.Show("人人评论获取失败,可能是网络问题,也可能是帐号过期", "失败", MessageBoxButton.OK);
             }
         });
     }
 }
예제 #7
0
 private void RenrenFeedGetCallback(object sender, APIRequestCompletedEventArgs e)
 {
     // Success
     if (e.Error == null)
     {
         DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List<RenrenNews>));
         App.ViewModel.RenrenItems.Clear();
         List<RenrenNews> searchResult = serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(e.ResultJsonString))) as List<RenrenNews>;
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             searchResult.ForEach(p =>
             {
                 ItemViewModel model = RenrenModelConverter.ConvertRenrenNewsToCommon(p);
                 if (model != null)
                 {
                     App.ViewModel.RenrenItems.Add(model);
                 }
             });
             m_progressIndicatorHelper.PopTask("Renren");
         });
     }
     // Fail
     else
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             if (!String.IsNullOrEmpty(PreferenceHelper.GetPreference("Renren_ID")))
             {
                 MessageBox.Show("人人信息源获取失败,可能是网络问题,也可能是帐号过期", ">_<", MessageBoxButton.OK);
             }
             m_progressIndicatorHelper.PopTask("Renren");
         });
     }
 }