private List <VkCommands.Data.IData> searchPeople(ISearchProfile sProfile,
                                                          int currentDepth, ISearchSubscriber subscriber)
        {
            List <IData> tergetUsers = new List <IData>();
            Friends      friends     = FriendsHelper.getFriends(CoreId);
            User         user        = null;
            bool         isTarget    = true;

            if (OnFirstStep)
            {
                for (int i = 0; i < friends.Users.Count; i++)
                {
                    if (isStopped)
                    {
                        return(tergetUsers);
                    }

                    user     = friends.Users[i];
                    isTarget = detectTargetUser(sProfile, user);
                    if (isTarget)
                    {
                        if (sProfile.CheckFriends)
                        {
                            if (!FriendsHelper.areFriends(user.Id,
                                                          AuthFactory.getCurrentAuth().InitialUser).GetAreFriends)
                            {
                                tergetUsers.Add(user);
                                subscriber.onItemFoundEvent(new ItemUpdatedEvent(user.Id));
                            }
                        }
                        else
                        {
                            tergetUsers.Add(user);
                            subscriber.onItemFoundEvent(new ItemUpdatedEvent(user.Id));
                        }
                    }
                    if (currentDepth < Depth)
                    {
                        //if (sProfile.Criteria[NextIterationCriteria].Equals(user.NextIterationCriteria))
                        //{
                        CoreId = user.Id;
                        tergetUsers.AddRange(searchPeople(sProfile, currentDepth + 1, subscriber));
                        //}
                    }
                }
            }
            return(tergetUsers);
        }
Esempio n. 2
0
        public static void generateData(ISearchSubscriber subscriber)
        {
            subscriber.onSearchStarted();
            Random rnd = new Random();

            for (int i = 0; i < COUNT; i++)
            {
                if (isStopped)
                {
                    isStopped = false;
                    subscriber.onSearchFinished();
                    break;
                }

                Thread.Sleep(200);
                subscriber.onItemFoundEvent(new ItemUpdatedEvent("TEST ITEM " + rnd.Next(1, 50000)));
            }
            subscriber.onSearchFinished();
        }