当前位置: 首页>>代码示例>>C#>>正文


C# TwitterContext.UpdateAccountImage方法代码示例

本文整理汇总了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());
         });
 }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:13,代码来源:AccountDemos.cs

示例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);
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:10,代码来源:AccountDemos.cs

示例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);
            }
        }
开发者ID:giggio,项目名称:tweetercloud,代码行数:27,代码来源:ErrorHandlingDemos.cs

示例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);
        }
开发者ID:giggio,项目名称:tweetercloud,代码行数:10,代码来源:AccountDemos.cs

示例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);
        }
开发者ID:CheyPMK,项目名称:linqtotwitter,代码行数:26,代码来源:AccountExtensionsTests.cs


注:本文中的LinqToTwitter.TwitterContext.UpdateAccountImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。