本文整理汇总了C#中LinqToTwitter.TwitterContext.UpdateAccountImage方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterContext.UpdateAccountImage方法的具体用法?C# TwitterContext.UpdateAccountImage怎么用?C# TwitterContext.UpdateAccountImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinqToTwitter.TwitterContext
的用法示例。
在下文中一共展示了TwitterContext.UpdateAccountImage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateAccountImageCallback
/// <summary>
/// Shows how to asynchronously update the image in an account
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
static void UpdateAccountImageCallback(TwitterContext twitterCtx)
{
twitterCtx.UpdateAccountImage(
@"..\..\images\200xColor_2.png", true,
response =>
{
Console.WriteLine("User Image: " + response.Status.ToString());
});
}
示例2: UpdateAccountImage
/// <summary>
/// Shows how to update the image in an account
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
static void UpdateAccountImage(TwitterContext twitterCtx)
{
var user = twitterCtx.UpdateAccountImage(@"..\..\images\200xColor_2.png", false);
Console.WriteLine("User Image: " + user.ProfileImageUrl);
}
示例3: HandleSideEffectWithFilePostExceptionDemo
/// <summary>
/// shows how to handle a TwitterQueryException with a side-effect causing a file post
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
private static void HandleSideEffectWithFilePostExceptionDemo(TwitterContext twitterCtx)
{
// force the error by supplying bad credentials
twitterCtx.AuthorizedClient = new UsernamePasswordAuthorization
{
UserName = "BadUserName",
Password = "BadPassword",
};
try
{
var user = twitterCtx.UpdateAccountImage(@"C:\Users\jmayo\Pictures\JoeTwitter.jpg");
}
catch (TwitterQueryException tqe)
{
// log it to the console
Console.WriteLine(
"\nHTTP Error Code: {0}\nError: {1}\nRequest: {2}\n",
tqe.HttpError,
tqe.Response.Error,
tqe.Response.Request);
}
}
示例4: UpdateAccountImage
/// <summary>
/// Shows how to update the image in an account
/// </summary>
/// <param name="twitterCtx">TwitterContext</param>
private static void UpdateAccountImage(TwitterContext twitterCtx)
{
var user = twitterCtx.UpdateAccountImage(@"C:\Users\jmayo\Pictures\Sgt Peppers\JoeTwitterBW.jpg");
Console.WriteLine("User Image: " + user.ProfileImageUrl);
}
示例5: UpdateAccountImage_Invokes_Executor_Execute
public void UpdateAccountImage_Invokes_Executor_Execute()
{
const string ImageFilePath = "c:\\image.jpg";
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, "", "");
User actual = ctx.UpdateAccountImage(ImageFilePath, SkipStatus);
execMock.Verify(exec =>
exec.PostTwitterFile(
"https://api.twitter.com/1.1/account/update_profile_image.json",
It.IsAny<Dictionary<string, string>>(),
It.IsAny<string>(),
It.IsAny<IRequestProcessor<User>>()),
Times.Once());
Assert.Equal(ExpectedName, actual.Name);
}