本文整理汇总了C#中LinqToTwitter.TwitterContext.UpdateAccountBackgroundImageAsync方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterContext.UpdateAccountBackgroundImageAsync方法的具体用法?C# TwitterContext.UpdateAccountBackgroundImageAsync怎么用?C# TwitterContext.UpdateAccountBackgroundImageAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinqToTwitter.TwitterContext
的用法示例。
在下文中一共展示了TwitterContext.UpdateAccountBackgroundImageAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateAccountBackgroundImageAsync
static async Task UpdateAccountBackgroundImageAsync(TwitterContext twitterCtx)
{
byte[] imageBytes = File.ReadAllBytes(@"..\..\Images\200xColor_2.png");
string mediaType = "image/png";
//// one way is to pass the byte[]
//var user1 =
// await twitterCtx.UpdateAccountBackgroundImageAsync(
// image: imageBytes,
// fileName: "LinqToTwitterLogo1.jpg",
// imageType: "png",
// tile: false,
// includeEntities: false,
// skipStatus: true);
// another way is to upload the media and pass a media ID
Media media = await twitterCtx.UploadMediaAsync(imageBytes, mediaType);
var user2 =
await twitterCtx.UpdateAccountBackgroundImageAsync(
media.MediaID,
fileName: "LinqToTwitterLogo2.png",
imageType: "png",
tile: false,
includeEntities: false,
skipStatus: true);
//if (user1 != null)
// Console.WriteLine("User1 Image: " + user1.ProfileImageUrl);
if (user2 != null)
Console.WriteLine("User2 Image: " + user2.ProfileImageUrl);
}
示例2: UpdateAccountBackgroundImageAsync
static async Task UpdateAccountBackgroundImageAsync(TwitterContext twitterCtx)
{
byte[] imageBytes = File.ReadAllBytes(@"..\..\Images\200xColor_2.png");
var user =
await twitterCtx.UpdateAccountBackgroundImageAsync(
image: imageBytes,
fileName: "200xColor_2.png",
imageType: "png",
tile: false,
use: true,
skipStatus: true);
if (user != null)
Console.WriteLine("User Image: " + user.ProfileImageUrl);
}