private async void Button_Click_1(object sender, RoutedEventArgs e) { string error = ""; this.IsEnabled = false; try { if (!string.IsNullOrEmpty(this.InputArea.Text)) { if (ImageFile != null) { var fileInfo = new RestAPICore.FileUploadInfo(); fileInfo.LocalPath = ImageFile.Name; fileInfo.StreamFactory = GetImageFile(ImageFile); var request = new SinaWeiboClientV2.StatusesUpload.Request { Status = this.InputArea.Text, Pic = fileInfo }; var response = await Weibo.ExecuteStatusesUploadAsync(request); } else { var request = new SinaWeiboClientV2.StatusesUpdate.Request { Status = this.InputArea.Text }; var response = await Weibo.ExecuteStatusesUpdateAsync(request); } } if (this.Parent is Popup) { ((Popup)this.Parent).IsOpen = false; } } catch (Exception ex) { error = ex.Message; } this.IsEnabled = true; if (!string.IsNullOrEmpty(error)) { var md = new MessageDialog(error); await md.ShowAsync(); } }