public void CollectFriends(string strUserSID, FriendCollection friends) { try { var FriendsCollection = ConnectionHelper.DB.GetCollection <FriendsEntity>("FriendsEntity"); var FindFriendsQuery = Query <FriendsEntity> .EQ(f => f.UserSID, strUserSID); var FindedFriends = FriendsCollection.FindOne(FindFriendsQuery); if (null != FindedFriends) { var UserCollection = ConnectionHelper.DB.GetCollection <UserEntity>("UserEntity"); Parallel.ForEach(FindedFriends.FriendSIDs, fSid => { var FindUserQuery = Query <UserEntity> .EQ(u => u.Sid, fSid); var FindedUser = UserCollection.FindOne(FindUserQuery); if (null != FindedUser) { Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new ThreadStart(() => { friends.Add(new Friend(FindedUser.ThumbnailPath, FindedUser.UserId, FindedUser.Sid, FindedUser.NickName, FindedUser.Comment)); })); } }); } } catch (Exception unExpectedException) { GlobalLogger.Log(unExpectedException.Message); } }
private void GetMajorFriend() { _Settings.MajorFriendMap.Clear(); FriendCollection coll; foreach (ChatListItem item in MajorFriendList.Items) { coll = new FriendCollection(); foreach (ChatListSubItem sitem in item.SubItems) { coll.Add(sitem.Info); } // if (_Settings.MajorFriendMap.ContainsKey(item.Value)) { _Settings.MajorFriendMap[item.Value] = coll; } else { _Settings.MajorFriendMap.Add(item.Value, coll); } } }
public void CollectFriends(string strUserSID, FriendCollection friends) { m_Logger.Log("Mocking CollectFriends Raised", Category.Info, Priority.None); Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new ThreadStart(() => { friends.Add(new Friend(null, "", "Paul", "Bye! See you!", TDD)); friends.Add(new Friend(null, "", "Jacob", "Really?", CI)); friends.Add(new Friend(null, "", "Michael", "When is your birthday?", CI)); friends.Add(new Friend(null, "", "Alexander", "Oh, i see...", SA)); friends.Add(new Friend(null, "", "William", "Anyway, i will get there", SE)); friends.Add(new Friend(null, "", "Joshua", "Shut up!!!", DP)); friends.Add(new Friend(null, "", "Daniel", "Can i see?", TDD)); friends.Add(new Friend(null, "", "Jayden ", "i wanaa go home....ohoh", DP)); friends.Add(new Friend(null, "", "Noah ", "tell me how am i supposed live without you..?", SA)); friends.Add(new Friend(null, "", "Anthony", "Bye! bye...bye...", CI)); friends.Add(new Friend(null, "", "Christopher", "i'm Crying now...", SE)); friends.Add(new Friend(null, "", "Aiden", "Did you see that?", SA)); friends.Add(new Friend(null, "", "Matthew", "Maybe. On september?", SE)); friends.Add(new Friend(null, "", "David", "How are you David?", SA)); friends.Add(new Friend(null, "", "Andrew", "Just 3 days remain..", DP)); friends.Add(new Friend(null, "", "Joseph ", "Remember!", TDD)); friends.Add(new Friend(null, "", "Logan", "Perfect! wonderful!!", CI)); friends.Add(new Friend(null, "", "Ryan", "let me see your info..", SA)); })); }