public static async Task <Status> ShareAsync(this IWeiboClient client, string status, StorageFile imageFile, CancellationToken cancellationToken = default(CancellationToken)) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (status == null) { throw new ArgumentNullException(nameof(status)); } if (imageFile == null) { throw new ArgumentNullException(nameof(imageFile)); } var image = (await FileIO.ReadBufferAsync(imageFile)).ToArray(); return(await client.ShareAsync(status, image, cancellationToken)); }
private async void SendStatusButton_Click(object sender, RoutedEventArgs e) { var status = await _client.ShareAsync("测试 https://wpdn.bohan.co/az/hprichbg/rb/MandelaMonument_EN-US8903823453_1920x1080.jpg"); MessageBox.Show(status.Success() ? "发送成功" : status.ErrorMessage); }