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();
});
}
}