コード例 #1
0
        private List <Message> GetUserWallTwitter()
        {
            List <Message> messageList = new List <Message>();

            try
            {
                TwitterDataProvider twitterProvider = new TwitterDataProvider(TwitterInformation.ApiInfo);
                messageList.AddRange(twitterProvider.GetUserHomeTimeLine(MessageCount));
            }
            catch (Exception ex)
            {
                ThrownExceptions.Add(ex);
            }
            return(messageList);
        }
コード例 #2
0
        private void StartFirstThread()
        {
            var apiInfo = new TwitterApiInfo
            {
                AccessToken       = "313315355-DT9HzoZKyLC4WbfKblVh5KAMyE0IGvtx5XFDtUx5",
                AccessTokenSecret = "7BhEPtC9RaQK0VIHmrugaimXXoOYjxxVhZGpcxw1w",
                ConsumerKey       = "hYd5c8gYxhy3T2Nvj8wLA",
                ConsumerSecret    = "KZGPvAN6kgioWlf0zrGYOzKevLatexuuuJlIhJQg"
            };

            var provider = new TwitterDataProvider(apiInfo);

            try
            {
                var result   = provider.GetUrlOfUserImage("kamorin_roman", TwitterDataProvider.ImageSize.Small);
                var messages = provider.GetUserHomeTimeLine(10);
            }
            catch (Exception) { }

            Console.WriteLine("First thread complete");
        }
コード例 #3
0
        static private void StartSecondThread()
        {
            var errorsCount = 0;
            var apiInfo     = new TwitterApiInfo
            {
                AccessToken       = "333874355-YBK9kp8Qc0mtRuYp9org5XegCX3DZKwycJdZZd8l",
                AccessTokenSecret = "q0qjlrXlehPag6mNqamvMhoLtb6z2bPUPDRh27HKN7Y",
                ConsumerKey       = "hYd5c8gYxhy3T2Nvj8wLA",
                ConsumerSecret    = "KZGPvAN6kgioWlf0zrGYOzKevLatexuuuJlIhJQg"
            };

            var provider = new TwitterDataProvider(apiInfo);

            for (var i = 0; i < MaxIterations; i++)
            {
                Thread.Sleep(100);
                try
                {
                    provider.GetUserHomeTimeLine(1);
                    Console.WriteLine("Second thread: Success. Iteration {0} ", i + 1);
                }
                catch (Exception)
                {
                    Console.WriteLine("Second thread: Exception. Iteration {0} ", i + 1);
                    errorsCount++;

                    if (errorsCount == MaxErrorsCount)
                    {
                        Console.WriteLine("Second thread: Exception Max count reached. Breaking. Iteration {0} ", i + 1);
                        break;
                    }
                }
            }

            Console.WriteLine("Second thread complete");
        }