當前位置: 首頁>>代碼示例>>C#>>正文


C# TwitterService.ListTweetsOnFriendsTimeline方法代碼示例

本文整理匯總了C#中TweetSharp.TwitterService.ListTweetsOnFriendsTimeline方法的典型用法代碼示例。如果您正苦於以下問題:C# TwitterService.ListTweetsOnFriendsTimeline方法的具體用法?C# TwitterService.ListTweetsOnFriendsTimeline怎麽用?C# TwitterService.ListTweetsOnFriendsTimeline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TweetSharp.TwitterService的用法示例。


在下文中一共展示了TwitterService.ListTweetsOnFriendsTimeline方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: appbar_button1_Click

        private void appbar_button1_Click(object sender, EventArgs e)
        {
            listdata.Visibility = Visibility.Collapsed;
            listdata2.Visibility = Visibility.Collapsed;
            listdata3.Visibility = Visibility.Collapsed;
            listdata4.Visibility = Visibility.Collapsed;
            loadtext.Visibility = Visibility.Visible;
            pgbar.Visibility = Visibility.Visible;
            var item = (PivotItem)title.SelectedItem;
            string header = (string)item.Header;
            service = new TwitterService("g8F2KdKH40gGp9BXemw13Q", "OyFRFsI05agcJtURtLv8lpYbYRwZAIL5gr5xQNPW0Q");
            service.AuthenticateWith((string)settings["twitter_token"], (string)settings["twitter_tokensecret"]);
            if (header == "recent")
            {
                service.ListTweetsOnFriendsTimeline(0, 40,
                (tweets, response) =>
                {
                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        DateTime ti = DateTime.Now;
                        DateTime now = ti.ToUniversalTime();

                        lists = new List<Tweet>();
                        foreach (var tweet in tweets)
                        {
                            Tweet tv = new Tweet();
                            TimeSpan tsp = now - tweet.CreatedDate;
                            tv.id = tweet.Id;
                            tv.name = tweet.User.ScreenName;
                            tv.thumb_img = tweet.User.ProfileImageUrl;
                            tv.text = tweet.Text + "\n";

                            if (tsp.Days > 0)
                                tv.time = tsp.Days + "일 전";
                            else if (tsp.Hours > 0)
                                tv.time = tsp.Hours + "시간 전";
                            else
                                tv.time = tsp.Minutes + "분 전";

                            lists.Add(tv);
                        }
                        Dispatcher.BeginInvoke(delegate()
                        {
                            if (lists.Count > 0)
                            {
                                loadtext.Visibility = Visibility.Collapsed;
                                pgbar.Visibility = Visibility.Collapsed;
                                listdata.ItemsSource = lists;
                                listdata.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                pgbar.Visibility = Visibility.Collapsed;
                                loadtext.Text = "No items";
                            }

                        });
                    }
                });
            }
            else if (header == "replies")
            {
                service.ListTweetsMentioningMe(0, 40,
                (tweets, response) =>
                {
                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        DateTime ti = DateTime.Now;
                        DateTime now = ti.ToUniversalTime();

                        lists = new List<Tweet>();
                        foreach (var tweet in tweets)
                        {
                            Tweet tv = new Tweet();
                            TimeSpan tsp = now - tweet.CreatedDate;
                            tv.id = tweet.Id;
                            tv.name = tweet.User.ScreenName;
                            tv.thumb_img = tweet.User.ProfileImageUrl;
                            tv.text = tweet.Text + "\n";

                            if (tsp.Days > 0)
                                tv.time = tsp.Days + "일 전";
                            else if (tsp.Hours > 0)
                                tv.time = tsp.Hours + "시간 전";
                            else
                                tv.time = tsp.Minutes + "분 전";
                            lists.Add(tv);
                        }
                        Dispatcher.BeginInvoke(delegate()
                        {
                            if (lists.Count > 0)
                            {
                                loadtext.Visibility = Visibility.Collapsed;
                                pgbar.Visibility = Visibility.Collapsed;
                                listdata2.ItemsSource = lists;
                                listdata2.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                pgbar.Visibility = Visibility.Collapsed;
//.........這裏部分代碼省略.........
開發者ID:vapps,項目名稱:HDStream,代碼行數:101,代碼來源:TwitterView.xaml.cs

示例2: GetUpdates

        public IEnumerable<ChannelStatusUpdate> GetUpdates(int pageSize)
        {
            var service = new TwitterService(ChannelHelper.ConsumerKey, ChannelHelper.ConsumerSecret, ChannelHelper.Token, ChannelHelper.TokenSecret);
            var result = service.ListTweetsOnFriendsTimeline();

            foreach (var tweet in result)
            {
                yield return new ChannelStatusUpdate
                {
                    ChannelStatusKey = tweet.Id.ToString(),
                    Status = tweet.Text,
                    From = new SourceAddress(
                        tweet.User.ScreenName,
                        tweet.User.Name,
                        tweet.User.ProfileImageUrl.Replace("_normal.jpg", "_mini.jpg")),
                    DatePosted = tweet.CreatedDate
                };
            }
        }
開發者ID:Klaudit,項目名稱:inbox2_desktop,代碼行數:19,代碼來源:TwitterClientChannel.cs


注:本文中的TweetSharp.TwitterService.ListTweetsOnFriendsTimeline方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。