本文整理汇总了C#中LinqToTwitter.TwitterContext.UpdateAccountBackgroundImage方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterContext.UpdateAccountBackgroundImage方法的具体用法?C# TwitterContext.UpdateAccountBackgroundImage怎么用?C# TwitterContext.UpdateAccountBackgroundImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinqToTwitter.TwitterContext
的用法示例。
在下文中一共展示了TwitterContext.UpdateAccountBackgroundImage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateAccountBackgroundImageBytes
/// <summary>
/// Shows how to update the background image in an account
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
private static void UpdateAccountBackgroundImageBytes(TwitterContext twitterCtx)
{
byte[] fileBytes = Utilities.GetFileBytes(@"C:\Users\jmayo\Documents\linq2twitter\linq2twitter\200xColor_2.png");
var user = twitterCtx.UpdateAccountBackgroundImage(fileBytes, "200xColor_2.png", "png", false);
Console.WriteLine("User Image: " + user.ProfileBackgroundImageUrl);
}
示例2: UpdateAccountBackgroundImageAndTileDemo
/// <summary>
/// Shows how to update the background image in an account and tiles the image
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
static void UpdateAccountBackgroundImageAndTileDemo(TwitterContext twitterCtx)
{
byte[] fileBytes = Utilities.GetFileBytes(@"..\..\images\200xColor_2.png");
var user = twitterCtx.UpdateAccountBackgroundImage(fileBytes, "200xColor_2.png", "png", true, true, true, true);
Console.WriteLine("User Image: " + user.ProfileBackgroundImageUrl);
}
示例3: UpdateAccountBackgroundImageAndTileDemo
/// <summary>
/// Shows how to update the background image in an account and tiles the image
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
private static void UpdateAccountBackgroundImageAndTileDemo(TwitterContext twitterCtx)
{
byte[] fileBytes = Utilities.GetFileBytes(@"C:\Users\jmayo\Documents\linq2twitter\linq2twitter\linq2twitter_v3_300x90.png");
var user = twitterCtx.UpdateAccountBackgroundImage(fileBytes, "linq2twitter_v3_300x90.png", "png", true);
Console.WriteLine("User Image: " + user.ProfileBackgroundImageUrl);
}
示例4: HandleOAuthFilePostDemo
/// <summary>
/// hows how to use OAuth to post a file to Twitter
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
private static void HandleOAuthFilePostDemo(TwitterContext twitterCtx)
{
if (twitterCtx.AuthorizedClient.IsAuthorized)
{
var user = twitterCtx.UpdateAccountBackgroundImage(
@"C:\Users\jmayo\Documents\linq2twitter\linq2twitter\200xColor_2.png", false);
Console.WriteLine(
"Name: {0}\nImage: {1}\n",
user.Name,
user.ProfileBackgroundImageUrl);
}
}
示例5: UpdateAccountBackgroundImage
/// <summary>
/// Shows how to update the background image in an account
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
static void UpdateAccountBackgroundImage(TwitterContext twitterCtx)
{
var user = twitterCtx.UpdateAccountBackgroundImage(@"..\..\images\200xColor_2.png", false, true, true, true);
Console.WriteLine("User Image: " + user.ProfileBackgroundImageUrl);
}
示例6: UpdateAccountBackgroundImageWithProgressUpdates
/// <summary>
/// Shows how to update the background image in an account
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
static void UpdateAccountBackgroundImageWithProgressUpdates(TwitterContext twitterCtx)
{
twitterCtx.UploadProgressChanged +=
(sender, e) =>
{
Console.WriteLine("Progress: {0}%", e.PercentComplete);
};
byte[] fileBytes = Utilities.GetFileBytes(@"..\..\images\200xColor_2.png");
var user = twitterCtx.UpdateAccountBackgroundImage(fileBytes, "200xColor_2.png", "png", false, true, true, true);
Console.WriteLine("User Image: " + user.ProfileBackgroundImageUrl);
}
示例7: UpdateAccountBackgroundImage
/// <summary>
/// Shows how to update the background image in an account
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
private static void UpdateAccountBackgroundImage(TwitterContext twitterCtx)
{
var user = twitterCtx.UpdateAccountBackgroundImage(@"C:\Users\jmayo\Documents\linq2twitter\linq2twitter\linq2twitter_v3_300x90.png", false);
Console.WriteLine("User Image: " + user.ProfileBackgroundImageUrl);
}
示例8: HandleOAuthUpdateAccountBackgroundImageWithProgressUpdatesDemo
/// <summary>
/// Shows how to update the background image with OAuth
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
private static void HandleOAuthUpdateAccountBackgroundImageWithProgressUpdatesDemo(TwitterContext twitterCtx)
{
if (twitterCtx.AuthorizedClient.IsAuthorized)
{
twitterCtx.UploadProgressChanged +=
(sender, e) =>
{
Console.WriteLine("Progress: {0}%", e.PercentComplete);
};
byte[] fileBytes = Utilities.GetFileBytes(@"C:\Users\jmayo\Documents\linq2twitter\linq2twitter\200xColor_2.png");
var user = twitterCtx.UpdateAccountBackgroundImage(fileBytes, "200xColor_2.png", "png", true, true, true, true);
Console.WriteLine("User Image: " + user.ProfileBackgroundImageUrl);
}
}
示例9: UpdateAccountBackgroundImage_Invokes_Executor_PostTwitterFile
public void UpdateAccountBackgroundImage_Invokes_Executor_PostTwitterFile()
{
const string ImageFilePath = "C:\\image.png";
const bool Tile = false;
const bool Use = false;
const string ExpectedName = "Twitter API";
const bool SkipStatus = true;
execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
execMock.Setup(exec =>
exec.PostTwitterFile(
It.IsAny<string>(),
It.IsAny<Dictionary<string, string>>(),
It.IsAny<string>(),
It.IsAny<IRequestProcessor<User>>()))
.Returns(SingleUserResponse);
var ctx = new TwitterContext(authMock.Object, execMock.Object, "https://api.twitter.com/1.1/", "");
User actual = ctx.UpdateAccountBackgroundImage(ImageFilePath, Tile, Use, true, SkipStatus);
execMock.Verify(exec =>
exec.PostTwitterFile(
"https://api.twitter.com/1.1/account/update_profile_background_image.json",
It.IsAny<Dictionary<string, string>>(),
It.IsAny<string>(),
It.IsAny<IRequestProcessor<User>>()),
Times.Once());
Assert.Equal(ExpectedName, actual.Name);
}