Пример #1
0
        private static async void PosterTwitterFromMVC(Profile item)
        {
            IAuthorizer auth = new PinAuthorizer()
            {
                CredentialStore = new InMemoryCredentialStore
                {
                    ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"].ToString(),// "0vbuhbtd8Zz7M121MtxtrA",
                    ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"].ToString(),// "5aj5te5ygcpPCBOMrwvGcjI8GAoAfAZFMlpLhyt2U"
                    OAuthToken = item.AccessToken,// "164334839-o5Dq8UKqZCLqooAHBOeuGDKgcx9ExTfO2FMvMxti",
                    OAuthTokenSecret = item.TokenSecret // "9vy702RGpq4sGPJEGAuQy0tsVOIsN3gu53MImpyPizI1f"

                }
            };

            var ctx = new TwitterContext(auth);

            //await ctx.TweetAsync("Testing from Application. MV Tweet!");
            var webClient = new WebClient();
            byte[] imageBytes = webClient.DownloadData(filename);
            await ctx.TweetWithMediaAsync("Test", false, imageBytes);
            Log.WriteLog("Twitter Post Done");
        }