Пример #1
0
        public static List <ContentPost> GetWall(String ownerId)
        {
            int offset = 0;
            int count  = 100;
            List <ContentPost> postsList = null;

            VkApiResponse <ContentPost> resp = Get100Posts(ownerId, offset, count);

            if (resp.response == null || resp.response.count == 0)
            {
                return(postsList);
            }
            else
            {
                postsList = new List <ContentPost>(resp.response.count);

                int i = resp.response.count;
                while (i > 0)
                {
                    foreach (ContentPost post in resp.response.items)
                    {
                        postsList.Add(post);
                    }
                    if (i > 100)
                    {
                        offset += 100;
                        resp    = Get100Posts(ownerId, offset, count);
                    }
                    i -= 100;
                }
                return(postsList);
            }
        }
Пример #2
0
        public void SetFriends(VkApiResponse <ContentUser> friendsResp)
        {
            if (friendsResp.response != null)
            {
                friends = new List <VkUser>();

                foreach (ContentUser friend in friendsResp.response.items)
                {
                    // TODO insert into DB (INSERT IGNORE)
                    AddFriend(friend);
                }
            }
        }
Пример #3
0
        public static List <VkUser> GetGroupMembersGraph(String groupName)
        {
            //Получение участников группы
            VkApiResponse <ContentUser> resp = GetGroupsMembers(groupName);
            //

            List <VkUser> groupMembersGraph = new List <VkUser>(resp.response.count);
            int           i = 0;

            //Получение друзей членов группы
            foreach (ContentUser user in resp.response.items)
            {
                groupMembersGraph.Insert(i, new VkUser(user));
                groupMembersGraph[i].SetFriends(GetFriends(user.id.ToString()));

                i++;
                Thread.Sleep(220);
            }
            //
            return(groupMembersGraph);
        }