• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LinqToTwitter.List类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中LinqToTwitter.List的典型用法代码示例。如果您正苦于以下问题:C# List类的具体用法?C# List怎么用?C# List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



List类属于LinqToTwitter命名空间,在下文中一共展示了List类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: UserTweets

        public List<Status> UserTweets(string inUserName_)
        {
            List<Status> statusList = new List<Status>(from tweet in _twitterCtx.Status
                                                       where tweet.Type == StatusType.User &&
                                                               tweet.ScreenName == inUserName_ &&
                                                               tweet.Count == Cfg_Twitter.AMT_TWEET_QUERY &&
                                                               tweet.RetweetedStatus.StatusID == 0
                                                       select tweet);

            ulong maxID = statusList[statusList.Count - 1].StatusID;
            int prevCount = statusList.Count;

            while (prevCount > 1)
            {
                if (statusList.Count > Cfg_Twitter.AMT_MAX_TWEETS)
                    break;

                List<Status> tmp = (from tweet in _twitterCtx.Status
                                    where tweet.Type == StatusType.User &&
                                            tweet.ScreenName == inUserName_ &&
                                            tweet.Count == Cfg_Twitter.AMT_TWEET_QUERY &&
                                            tweet.RetweetedStatus.StatusID == 0 &&
                                            tweet.MaxID == maxID
                                    select tweet).ToList();
                if (tmp.Count == 1)
                    break;

                statusList.AddRange(tmp);
                maxID = tmp[tmp.Count - 1].StatusID;
            }

            return statusList;
        }
开发者ID:ramatronics,项目名称:baewatch,代码行数:33,代码来源:TwitterAdapter.cs


示例2: Load

        private static IList<Status> Load(IQueryBuilder queryBuilder, ulong maxId, int count = 2000)
        {
            var statuses = new List<Status>();
            //todo limit exception System.AggregateException, message: Rate limit exceeded - Please visit the LINQ to Twitter FAQ (at the HelpLink) for help on resolving this error.
            var tweetQuery = queryBuilder.BuildTaskByMinId(maxId + 1).ToList();

            statuses.AddRange(tweetQuery);

            if (statuses.Count < 150)
            {
                return statuses;
            }

            while (statuses.Count < count)
            {
                tweetQuery = queryBuilder.BuildTaskByMinIdAndMaxId(maxId + 1, statuses[statuses.Count - 1].StatusID - 1).ToList();

                statuses.AddRange(tweetQuery);
                if (tweetQuery.Count < 150)
                {
                    break;
                }
            }
            return statuses;
        }
开发者ID:Stelmashenko-A,项目名称:CourseWork,代码行数:25,代码来源:UpDater.cs


示例3: CacheAccountList

 private void CacheAccountList(List<Domain.Model.Account> accounts)
 {
     foreach(var item in accounts)
     {
         this.accountCache.Add(item.AccountId.ToString(), item, DateTimeOffset.Now.AddMinutes(20));
     }
 }
开发者ID:jefferydalton,项目名称:TwitterAnalyzer,代码行数:7,代码来源:AccountQueryRepositoryLinqToTwitter.cs


示例4: FenetrePrincipale

 public FenetrePrincipale()
 {
     InitializeComponent();
     listeTweets = new List<TweetControl>();
     vScrollBar1.Maximum = nbTweetsToShow * ConfigurationManager.HEIGHT_TWEET_CONTROL - this.Height + ConfigurationManager.HEIGHT_TOOLBAR;
     recupererTweets();
 }
开发者ID:MichaelMondou,项目名称:Cours,代码行数:7,代码来源:FenetrePrincipale.cs


示例5: GetRecent200

        private void GetRecent200()
        {
            var twitterContext = new TwitterContext(authorizedUser);
            var tweets = from tweet in twitterContext.Status where tweet.Type == StatusType.Home && tweet.Count select tweet;

            currentTweets = tweets.ToList();
        }
开发者ID:mcnuggz,项目名称:pastime_site,代码行数:7,代码来源:Form1.cs


示例6: RemoveSiteStreamUser

        /// <summary>
        /// Removes one or more users from a Site Stream
        /// </summary>
        /// <param name="ctx">Twitter Context</param>
        /// <param name="userIDs">List of user IDs to remove from Site Stream</param>
        /// <param name="streamID">ID of Site Stream to remove users from</param>
        /// <param name="callback">Async Callback</param>
        /// <returns>Control Stream with CommandResponse property for Twitter's response message</returns>
        public static ControlStream RemoveSiteStreamUser(this TwitterContext ctx, List<ulong> userIDs, string streamID, Action<TwitterAsyncResponse<ControlStream>> callback)
        {
            if (string.IsNullOrEmpty(streamID)) throw new ArgumentNullException("streamID", "streamID is required.");

            var newUrl = ctx.SiteStreamUrl + "site/c/" + streamID + "/remove_user.json";

            string userIDString = string.Join(",", userIDs.Select(user => user.ToString()).ToArray());

            var reqProc = new ControlStreamRequestProcessor<ControlStream>();

            var twitExe = ctx.TwitterExecutor;

            twitExe.AsyncCallback = callback;
            var resultsJson =
                twitExe.PostToTwitter(
                    newUrl,
                    new Dictionary<string, string>
                    {
                        {"user_id", userIDString}
                    },
                    response => reqProc.ProcessActionResult(response, ControlStreamType.Info));

            ControlStream cs = reqProc.ProcessActionResult(resultsJson, ControlStreamType.Info);
            return cs;
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:33,代码来源:ControlStreamExtensions.cs


示例7: GetTweetsFor

        public async Task<IEnumerable<TweetDto>> GetTweetsFor(IEnumerable<string> tweetsIds)
        {
            var tweetsIdsList = tweetsIds.Select(s => Convert.ToUInt64(s)).Materialize();

            if (tweetsIdsList.IsEmpty())
            {
                return Enumerable.Empty<TweetDto>();
            }

            using (var twitterContext = CreateContext())
            {
                var results = new List<TweetDto>();
                foreach (var tweetsId in tweetsIdsList)
                {
                    var id = tweetsId;
                    var tweet = await
                    twitterContext.Status
                        .Where(status => status.Type == StatusType.Show && status.ID == id).FirstOrDefaultAsync();
                    if (tweet != null)
                    {
                        results.Add(BuildTweetDto(tweet));
                    }
                }

                return results;
            }
        }
开发者ID:michalczukm,项目名称:search-tweets.win8.1.phone,代码行数:27,代码来源:TwitterFeedService.cs


示例8: Status

        public JsonResult Status(string id)
        {
            Authorize();
            string screenName = ViewBag.User;
            IEnumerable<TweetViewModel> friendTweets = new List<TweetViewModel>();

            if (string.IsNullOrEmpty(screenName))
            {
                return Json(friendTweets, JsonRequestBehavior.AllowGet);
            }

            twitterCtx = new TwitterContext(auth);

            friendTweets =
                (
                from tweet in twitterCtx.Status
                 where tweet.Type == StatusType.Show &&
                       tweet.ID == id
                 select GetTweetViewModel(tweet))
                .ToList();

            if (friendTweets.Count() > 0)
                return Json(friendTweets.ElementAt(0), JsonRequestBehavior.AllowGet);
            else
                return Json(new TweetViewModel { Tweet = "Requested Status Not Found" }, JsonRequestBehavior.AllowGet);
        }
开发者ID:jahewett,项目名称:AngularJsTwitterApp,代码行数:26,代码来源:HomeController.cs


示例9: GetFollowers

        private List<string> GetFollowers()
        {
            List<string> results = new List<string>();

            var twitterContext = new TwitterContext(authorizedUser);

            var temp = Enumerable.FirstOrDefault(from friend in twitterContext.Friendship
                                                 where friend.Type == FriendshipType.FollowersList &&
                                                 friend.ScreenName == "Bostato90" &&
                                                 friend.Count == 200
                                                 select friend);
            if (temp != null)
            {
                temp.Users.ToList().ForEach(user => results.Add(user.Name));

                while (temp != null && temp.CursorMovement.Next != 0)
                {
                    temp = Enumerable.FirstOrDefault(from friend in twitterContext.Friendship
                                                      where friend.Type == FriendshipType.FollowersList &&
                                                      friend.ScreenName == "Bostato90" &&
                                                      friend.Count == 200 &&
                                                      friend.Cursor == temp.CursorMovement.Next
                                                      select friend);
                    if (temp != null) temp.Users.ToList().ForEach(user => results.Add(user.Name));
                }
            }
            return results;
        }
开发者ID:mcnuggz,项目名称:pastime_site,代码行数:28,代码来源:Form1.cs


示例10: TweetGrid

 public TweetGrid()
 {
     InitializeComponent();
     panelDisabled.Dock = DockStyle.Fill;
     splitContainer1.Dock = DockStyle.Fill;
     Panes = new List<TweetPane>();
 }
开发者ID:swatt6400,项目名称:NetOffice,代码行数:7,代码来源:TweetGrid.cs


示例11: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			var auth = new OAuth1Authenticator ("Ywun66NxYNMXgjzNRdIG12q4k",
				"XQAQ5djSlMOiXfMhn5rl4fdPahqw0wNPW6nBS5I9aRCajbxMvJ",
				new Uri("https://api.twitter.com/oauth/request_token"),
				new Uri("https://api.twitter.com/oauth/authorize"),
				new Uri("https://api.twitter.com/oauth/access_token"),
				new Uri("http://mobile.twitter.com"));

			auth.Completed += (sender, e) => {
				DismissViewController (true, null);
				if (e.IsAuthenticated) {

					loggedInAccount = e.Account;
					GetUserData ();
					var mList =   GetTwitterData();
					mList.ContinueWith(async (Task<List<Status>> arg) =>{
						myList = arg.Result;
						//twitterHomeTableView.Source = new TwitterHomeSource(arg.Result.ToArray());
					});


				}

			};

			var ui = auth.GetUI();
			PresentViewController(ui, true, null);
		}
开发者ID:poojagaonkar,项目名称:PGDemoIOS,代码行数:30,代码来源:TwiiterTimelinecontroller.cs


示例12: Followers

        protected IList<string> Followers(TwitterContext twitterCtx, string user)
        {
            var result = new List<string>();
            long cursor = -1;
            do
            {
                var friendship = (from friend in twitterCtx.Friendship
                    where friend.Type == FriendshipType.FriendsList &&
                          friend.ScreenName == user &&
                          friend.Cursor == cursor
                    select friend)
                    .SingleOrDefaultAsync().Result;

                if (friendship != null &&
                    friendship.Users != null &&
                    friendship.CursorMovement != null)
                {
                    cursor = friendship.CursorMovement.Next;

                }

                if (friendship != null && friendship.Users != null)
                    result.AddRange(friendship.Users.Select(x => x.UserIDResponse));
            } while (cursor != 0);
            return result;
        }
开发者ID:Stelmashenko-A,项目名称:CourseWork,代码行数:26,代码来源:Initializer.cs


示例13: Main

        static void Main(string[] args)
        {
            if (!EnsureSingleLoad())
            {
                Console.WriteLine("{0}: Another Instance Currently Runing", DateTime.Now);
                return;
            }

            var streamMonitors = new List<DualStreamMonitor>();

            UsersCollection.PrimaryUsers().AsParallel()
                .ForAll(u =>
            {
                var streamMonitor = new DualStreamMonitor(u, Console.Out);
                streamMonitor.Start();

                lock (streamMonitors)
                {
                    streamMonitors.Add(streamMonitor);
                }
            });

            while (Console.ReadLine() != "exit") ;

            streamMonitors.ForEach(s => s.Stop());
        }
开发者ID:postworthy,项目名称:postworthy,代码行数:26,代码来源:Program.cs


示例14: Relationship

        public Relationship(JsonData relJson)
        {
            if (relJson == null) return;

            ScreenName = relJson.GetValue<string>("screen_name");
            Name = relJson.GetValue<string>("name");
            RetweetsWanted = relJson.GetValue<bool>("want_retweets");
            AllReplies = relJson.GetValue<bool>("all_replies");
            MarkedSpam = relJson.GetValue<bool>("marked_spam");
            ID = relJson.GetValue<ulong>("id");
            Blocking = relJson.GetValue<bool>("blocking");
            NotificationsEnabled = relJson.GetValue<bool>("notifications_enabled");
            CanDm = relJson.GetValue<bool>("can_dm");
            Muting = relJson.GetValue<bool>("muting", false);

            var connections = relJson.GetValue<JsonData>("connections");
            if (connections != null)
                Connections =
                    (from JsonData connection in connections
                     select connection.ToString())
                    .ToList();
            else
                Connections = new List<string>();

            FollowedBy = 
                relJson.GetValue<bool>("followed_by") ||
                Connections.Contains("followed_by");
            Following = 
                relJson.GetValue<bool>("following") ||
                Connections.Contains("following");
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:31,代码来源:Relationship.cs


示例15: ShowFavoritesAsync

        static async Task ShowFavoritesAsync(TwitterContext twitterCtx)
        {
            const int PerQueryFavCount = 200;

            // set from a value that you previously saved
            ulong sinceID = 1; 

            var favsResponse =
                await
                    (from fav in twitterCtx.Favorites
                     where fav.Type == FavoritesType.Favorites &&
                           fav.Count == PerQueryFavCount
                     select fav)
                    .ToListAsync();

            if (favsResponse == null)
            {
                Console.WriteLine("No favorites returned from Twitter.");
                return;
            }

            var favList = new List<Favorites>(favsResponse);

            // first tweet processed on current query
            ulong maxID = favList.Min(fav => fav.StatusID) - 1;

            do
            {
                favsResponse =
                    await
                        (from fav in twitterCtx.Favorites
                         where fav.Type == FavoritesType.Favorites &&
                               fav.Count == PerQueryFavCount &&
                               fav.SinceID == sinceID &&
                               fav.MaxID == maxID
                         select fav)
                        .ToListAsync();

                if (favsResponse == null || favsResponse.Count == 0) break;

                // reset first tweet to avoid re-querying the
                // same list you just received
                maxID = favsResponse.Min(fav => fav.StatusID) - 1;
                favList.AddRange(favsResponse);

            } while (favsResponse.Count > 0);

            favList.ForEach(fav => 
            {
                if (fav != null && fav.User != null)
                    Console.WriteLine(
                        "Name: {0}, Tweet: {1}",
                        fav.User.ScreenNameResponse, fav.Text);
            });

            // save this in your db for this user so you can set
            // sinceID accurately the next time you do a query
            // and avoid querying the same tweets again.
            ulong newSinceID = favList.Max(fav => fav.SinceID);
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:60,代码来源:FavoriteDemos.cs


示例16: InitTweetViewModel

        public async Task InitTweetViewModel()
        {
            var auth = new ApplicationOnlyAuthorizer()
            {
                CredentialStore = new InMemoryCredentialStore
                {
                    ConsumerKey = "dYNbMI3KFn4zFrHIaAKIWCFYQ",
                    ConsumerSecret = "mQhDSmPov7bbJXb8jPwaVghBbUbgELpQqyHG2QRyf89CsQWKyb",
                },
            };
            await auth.AuthorizeAsync();

            var ctx = new TwitterContext(auth);

            var searchResponse = await
                (from search in ctx.Search
                 where search.Type == SearchType.Search &&
                       search.Query == "\"LINQ to Twitter\""
                 select search)
                .SingleAsync();

            Tweets =
                (from tweet in searchResponse.Statuses
                 select new Tweet
                 {
                     StatusID = tweet.StatusID,
                     ScreenName = tweet.User.ScreenNameResponse,
                     Text = tweet.Text,
                     ImageUrl = tweet.User.ProfileImageUrl
                 })
                .ToList();
        }
开发者ID:rockcliff15,项目名称:LinqToTwitter,代码行数:32,代码来源:TweetViewModel.cs


示例17: GetTweets

 public JsonResult GetTweets()
 {
     Authorize();
     string screenName = ViewBag.User;
     IEnumerable<TweetViewModel> friendTweets = new List<TweetViewModel>();
     if (string.IsNullOrEmpty(screenName))
     {
         return Json(friendTweets, JsonRequestBehavior.AllowGet);
     }
     twitterCtx = new TwitterContext(auth);
     friendTweets =
     (from tweet in twitterCtx.Status
      where tweet.Type == StatusType.Home &&
            tweet.ScreenName == screenName &&
            tweet.IncludeEntities == true
      select new TweetViewModel
      {
          ImageUrl = tweet.User.ProfileImageUrl,
          ScreenName = tweet.User.Identifier.ScreenName,
          MediaUrl = GetTweetMediaUrl(tweet),
          Tweet = tweet.Text
      })
     .ToList();
     return Json(friendTweets, JsonRequestBehavior.AllowGet);
 }
开发者ID:stuartdga,项目名称:MyTweets,代码行数:25,代码来源:HomeController.cs


示例18: ShowFriends

        public static async Task<List<User>> ShowFriends(IAuthorizer auth, string login)
        {
            var users = new List<User>();
            var twitterCtx = new TwitterContext(auth);

            Friendship friendship;
            long cursor = -1;
            do
            {
                friendship = await twitterCtx.Friendship.Where(x =>
                   x.Type == FriendshipType.FriendsList
                   && x.ScreenName == login
                   && x.Cursor == cursor
                   && x.Count == 200
                   && x.IncludeUserEntities == false)
                    .SingleOrDefaultAsync();

                if (friendship != null
                    && friendship.Users != null
                    && friendship.CursorMovement != null)
                {
                    cursor = friendship.CursorMovement.Next;
                    users.AddRange(friendship.Users);
                }
            } while (cursor != 0);
            return users;
        }
开发者ID:tarbii,项目名称:Collager,代码行数:27,代码来源:Twitter.cs


示例19: AddTweets

 /// <summary>
 /// 
 /// </summary>
 /// <param name="tweetList"></param>
 /// <param name="actionState"></param>
 public void AddTweets(List<TwitterEntity> tweetList, ActionState actionState)
 {
     TwitterRepository twitterRepository = new TwitterRepository();
     for (int i = 0; i < tweetList.Count; i++)
     {
         twitterRepository.Insert(tweetList[i], actionState);
     }
 }
开发者ID:sharmeran,项目名称:MongoTwitterApp,代码行数:13,代码来源:TwitterDomain.cs


示例20: GetAccount

 public Domain.Model.Account GetAccount(ulong accountId)
 {
     using (var twitterCtx = new TwitterContext(this.GetAuthKey()))
     {
         var accountIdList = new List<string>() { accountId.ToString() };
         return GetUsers(twitterCtx, accountIdList).FirstOrDefault();
     }
 }
开发者ID:jefferydalton,项目名称:TwitterAnalyzer,代码行数:8,代码来源:AccountQueryRepositoryLinqToTwitter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LinqToTwitter.TwitterContext类代码示例发布时间:2022-05-26
下一篇:
C# LinqToSQLModel.MainDBDataContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap