private void SinaWeiboSend()
{
String statusID = m_itemViewModel.ID;
if (String.IsNullOrEmpty(statusID))
return;
String commentText = StatusMessageBox.Text;
netEngine = new SdkNetEngine();
// Define a new command base
cmdBase = new SdkCmdBase
{
acessToken = App.SinaWeibo_AccessToken,
};
RestRequest request = new RestRequest();
request.Method = WebMethod.Post;
request.Path = "comments/create.json";
request.AddParameter("access_token", App.SinaWeibo_AccessToken);
request.AddParameter("id", statusID);
request.AddParameter("comment", commentText);
request.AddParameter("comment_ori", "0");
netEngine.SendRequest(request, cmdBase, (SdkResponse response) =>
{
if (response.errCode == SdkErrCode.SUCCESS)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("发送成功!");
// go back to CommentView.
// CommentView should refresh itself to show the newly added comment
NavigationService.GoBack();
}
);
}
else
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("发送失败!");
// go back to CommentView.
// CommentView should refresh itself to show the newly added comment
NavigationService.GoBack();
});
}
});
}