private void setAllPhotosOnListBox()
        {
            try
            {
                FacebookObjectCollection <Album> allAlbums = DataManagerWrapper.DataManager.GetAlbums();

                m_FilteredPhotosCollection = new FacebookObjectCollection <Photo>();
                int nodeCouner = 0;
                foreach (Album album in allAlbums)
                {
                    int photoCounter = 1;
                    foreach (Photo photo in album.Photos)
                    {
                        checkedListBoxPhotos.Items.Add(string.Format("{0} - Picture {1}", album.Name, photoCounter));
                        m_FilteredPhotosCollection.Add(photo);
                        photoCounter++;
                    }

                    nodeCouner++;
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch albums data.");
            }
        }
예제 #2
0
        private FacebookObjectCollection <IPictureAndNameOwner> getJoinedPages(User i_User1, User i_User2)
        {
            FacebookObjectCollection <IPictureAndNameOwner> joinedPages = null;

            try
            {
                if (i_User2 != null)
                {
                    joinedPages = new FacebookObjectCollection <IPictureAndNameOwner>();
                    if (i_User1.LikedPages != null)
                    {
                        foreach (Page user1LikedPage in i_User1.LikedPages)
                        {
                            foreach (Page user2LikedPage in i_User2.LikedPages)
                            {
                                if (user1LikedPage.Id == user2LikedPage.Id)
                                {
                                    joinedPages.Add(new PageAdapter(user1LikedPage));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            { // don't do nothing when we are loging out at the mainThread
            }

            return(joinedPages);
        }
예제 #3
0
        private void fetchPosts()
        {
            FacebookObjectCollection <Post> newListOfPosts = new FacebookObjectCollection <Post>();

            foreach (Post post in FacebookManager.Instance.LoggedInUser.Posts)
            {
                if (post.Message != null)
                {
                    newListOfPosts.Add(post);
                }
            }

            postBindingSource.DataSource = newListOfPosts;
            listBoxPosts.Invoke(new Action(() =>
            {
                listBoxPosts.DisplayMember = "Message";
                listBoxPosts.DataSource    = this.postBindingSource;
            }));


            if (newListOfPosts.Count == 0)
            {
                this.Invoke(new Action(() => MessageBox.Show("No Posts to retrieve :(")));
            }
        }
예제 #4
0
        public FacebookObjectCollection <User> FilterBySameBirthMonth()
        {
            FacebookObjectCollection <User> resCollection = new FacebookObjectCollection <User>();

            if (LoggedUser != null)
            {
                string birthday     = LoggedUser.Birthday;
                int    monthOfBirth = int.Parse(string.Format("{0}{1}", birthday[3], birthday[4]));
                int    friendMonthOfBirth;

                foreach (User friend in LoggedUser.Friends)
                {
                    birthday = friend.Birthday;
                    if (birthday != null)
                    {
                        friendMonthOfBirth = int.Parse(string.Format("{0}{1}", birthday[3], birthday[4]));
                        if (friendMonthOfBirth == monthOfBirth)
                        {
                            resCollection.Add(friend);
                        }
                    }
                }
            }

            return(resCollection);
        }
예제 #5
0
        public FacebookObjectCollection <User> GetNotActiveUsers()
        {
            FacebookObjectCollection <User> friends          = m_LoggedInUser.Friends;
            FacebookObjectCollection <User> notActiveFriends = new FacebookObjectCollection <User>();
            bool activeUser = false;

            foreach (User u in friends)
            {
                foreach (Post p in u.Posts)
                {
                    if (p.CreatedTime.Value.Year.Equals(DateTime.Today.Year))
                    {
                        activeUser = true;
                    }
                }

                if (!activeUser)
                {
                    notActiveFriends.Add(u);
                    m_Friends.Add(u.FirstName + " " + u.LastName, u);
                }

                activeUser = false;
            }

            return(notActiveFriends);
        }
예제 #6
0
        public FacebookObjectCollection <User> FilterFriends(Filter i_FilterBy)
        {
            FacebookObjectCollection <User> resCollection = new FacebookObjectCollection <User>();

            if (i_FilterBy.User != null)
            {
                string birthday    = i_FilterBy.User.Birthday;
                int    yearOfBirth = int.Parse(string.Format("{0}{1}{2}{3}", birthday[6], birthday[7], birthday[8], birthday[9]));
                int    friendYearOfBirth;

                foreach (User friend in i_FilterBy.User.Friends)
                {
                    birthday = friend.Birthday;
                    if (birthday != null)
                    {
                        friendYearOfBirth = int.Parse(string.Format("{0}{1}{2}{3}", birthday[6], birthday[7], birthday[8], birthday[9]));
                        if (friendYearOfBirth == yearOfBirth - i_FilterBy.YearDifference || friendYearOfBirth == yearOfBirth + i_FilterBy.YearDifference)
                        {
                            resCollection.Add(friend);
                        }
                    }
                }
            }

            return(resCollection);
        }
예제 #7
0
 internal void FetchFriendsList()
 {
     s_FriendList = new List <User>();
     m_FriendList = new FacebookObjectCollection <User>();
     try
     {
         if (m_LoginUser.Friends.Count == 0)
         {
             MessageBox.Show(Utils.k_NoDataToFetchMessage);
         }
         else
         {
             foreach (User friend in m_LoginUser.Friends)
             {
                 m_FriendList.Add(friend);
                 s_FriendList.Add(friend);
                 friend.ReFetch(DynamicWrapper.eLoadOptions.Full);
             }
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(String.Format(Utils.k_FetchPerrmissionDenyMessage, e.Message));
     }
 }
예제 #8
0
        private List <PlaceCategory> buildCommonFiendsPlaces(User i_FirstUser, FacebookObjectCollection <User> i_FbUsers)
        {
            List <PlaceCategory> commonPlaces = new List <PlaceCategory>();
            FacebookObjectCollection <Checkin> commonCheckins = new FacebookObjectCollection <Checkin>();

            foreach (Checkin userCheckin in i_FirstUser.Checkins)
            {
                bool isCommon = true;

                foreach (User nextUser in i_FbUsers)
                {
                    if (!nextUser.Checkins.Contains(userCheckin))
                    {
                        isCommon = false;
                        break;
                    }
                }

                if (isCommon)
                {
                    commonCheckins.Add(userCheckin);
                }
            }


            commonPlaces = buildCategories(commonCheckins);
            return(commonPlaces);
        }
예제 #9
0
        public FacebookObjectCollection <User> GetUpcomingBirthdays()
        {
            FacebookObjectCollection <User> upcomingBirthdays = new FacebookObjectCollection <User>();

            foreach (User friend in AppData.LoggedInUser.Friends)
            {
                FacebookDateAdapter facebookDate = new FacebookDateAdapter();
                try
                {
                    facebookDate.Date = friend.Birthday;
                    DateTime birthday = facebookDate.ToDateTime();
                    birthday.AddYears(DateTime.Now.Year - birthday.Year);

                    if (birthday <= DateTime.Now.AddDays(7) && birthday >= DateTime.Now)
                    {
                        upcomingBirthdays.Add(friend);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(upcomingBirthdays);
        }
예제 #10
0
        private FacebookObjectCollection <IPictureAndNameOwner> getJoinedEvents(User i_User1, User i_User2)
        {
            FacebookObjectCollection <IPictureAndNameOwner> joinedEvents = null;

            try
            {
                if (i_User2 != null)
                {
                    joinedEvents = new FacebookObjectCollection <IPictureAndNameOwner>();
                    if (i_User1.Events != null)
                    {
                        foreach (Event userEvent in i_User1.Events)
                        {
                            foreach (User attendingUser in userEvent.AttendingUsers)
                            {
                                if (attendingUser.Id == i_User2.Id)
                                {
                                    joinedEvents.Add(new EventAdapter(userEvent));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            { // don't do nothing when we are loging out at the mainThread
            }

            return(joinedEvents);
        }
        private void initNewsFeeds()
        {
            FacebookObjectCollection <PostListBoxAdapter> newsFeeds = new FacebookObjectCollection <PostListBoxAdapter>();

            foreach (Post post in m_User.NewsFeed)
            {
                newsFeeds.Add(new PostListBoxAdapter(post));
            }

            m_FilterableNewsFeeds = new FilterableCollection <PostListBoxAdapter>(newsFeeds);
            m_UserFriends         = m_User.Friends;
            Invoke(
                new Action(() =>
            {
                foreach (User friend in m_UserFriends)
                {
                    comboBoxFriendsNames.Items.Add(friend.Name);
                }

                string[] types = Enum.GetNames(typeof(Post.eType));
                foreach (string type in types)
                {
                    comboBoxPostTypes.Items.Add(type);
                }

                BindingSource binding       = new BindingSource();
                binding.DataSource          = newsFeeds;
                listBoxNewsFeeds.DataSource = binding;

                OprogressBarLoginAndFetchData.IncrementByOne();
            }),
                null);
        }
예제 #12
0
        private FacebookObjectCollection <Checkin> buildCommonFiendsPlaces()
        {
            FacebookObjectCollection <Checkin> FbUserCheckins = User.Checkins;
            FacebookObjectCollection <User>    FbFriends      = User.Friends;
            FacebookObjectCollection <Checkin> commonCheckins = new FacebookObjectCollection <Checkin>();

            foreach (Checkin userCheckin in User.Checkins)
            {
                bool isCommon = true;

                foreach (User nextUser in FbFriends)
                {
                    if (!nextUser.Checkins.Contains(userCheckin))
                    {
                        isCommon = false;
                        break;
                    }
                }

                if (isCommon)
                {
                    commonCheckins.Add(userCheckin);
                }
            }

            return(commonCheckins);
        }
예제 #13
0
        internal FacebookObjectCollection <AppUser> FindHitechWorkersContacts()
        {
            FacebookObjectCollection <AppUser> hitechWorkingContacts = new FacebookObjectCollection <AppUser>();
            string exceptionMessage = string.Empty;

            foreach (AppUser currentFriend in r_UserFriends)
            {
                try
                {
                    if (worksAtKnownHitechCompany(currentFriend) || worksAtPotentiallyHitechRelatedCompany(currentFriend))
                    {
                        hitechWorkingContacts.Add(currentFriend);
                    }
                }
                catch (Exception ex)
                {
                    exceptionMessage = ex.Message;
                }
            }

            if (hitechWorkingContacts.Count == 0 && !string.IsNullOrEmpty(exceptionMessage))
            {
                throw new Facebook.FacebookApiException(exceptionMessage);
            }

            return(hitechWorkingContacts);
        }
예제 #14
0
        internal FacebookObjectCollection <AppUser> FindAMatch(bool i_ChoseGirls, bool i_ChoseBoys, string i_AgeRange)
        {
            FacebookObjectCollection <AppUser> potentialMatches = new FacebookObjectCollection <AppUser>();
            string exceptionMessage = string.Empty;

            foreach (AppUser currentPotentialMatch in r_UserFriends)
            {
                try
                {
                    if (isUserSingle(currentPotentialMatch) && isUserWithinChosenAgeRange(currentPotentialMatch, i_AgeRange))
                    {
                        if ((!i_ChoseBoys && !i_ChoseGirls) || (i_ChoseBoys && i_ChoseGirls))
                        {
                            potentialMatches.Add(currentPotentialMatch);
                        }
                        else
                        {
                            eGender?userGender = currentPotentialMatch.GetGender();
                            if (userGender != null)
                            {
                                if (i_ChoseBoys && userGender == eGender.male)
                                {
                                    potentialMatches.Add(currentPotentialMatch);
                                }
                                else if (i_ChoseGirls && userGender == eGender.female)
                                {
                                    potentialMatches.Add(currentPotentialMatch);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    exceptionMessage = ex.Message;
                }
            }

            if (potentialMatches.Count == 0 && !string.IsNullOrEmpty(exceptionMessage))
            {
                throw new Facebook.FacebookApiException(exceptionMessage);
            }

            return(potentialMatches);
        }
예제 #15
0
        private void initFriends()
        {
            Friends = new FacebookObjectCollection<User>();

            foreach (User user in m_User.Friends)
            {
                Friends.Add(user);
            }
        }
예제 #16
0
        public FacebookObjectCollection <User> GetActiveUsers()
        {
            FacebookObjectCollection <User> activeUsers = new FacebookObjectCollection <User>();
            User activeUser = mostPictures();

            if (activeUser != null)
            {
                activeUsers.Add(activeUser);
            }

            activeUser = mostPosts();
            if (!activeUsers.Contains(activeUser) && activeUser != null)
            {
                activeUsers.Add(activeUser);
            }

            return(activeUsers);
        }
예제 #17
0
 public void FindCommon(User i_FirstUser, User i_SecUser)
 {
     PostsInCommon = new FacebookObjectCollection <Post>();
     foreach (Post post in i_FirstUser.PostsTaggedIn)
     {
         if (post.TaggedUsers.Contains(i_SecUser))
         {
             PostsInCommon.Add(post);
         }
     }
 }
예제 #18
0
        private void initUpcomingEvents()
        {
            UpcomingEvents = new FacebookObjectCollection<Event>();

            foreach (Event eve in m_User.EventsNotYetReplied)
            {
                //if (eve.EndTime > DateTime.Now)
                {
                    UpcomingEvents.Add(eve);
                }
            }
        }
예제 #19
0
            public EnumerableUserData(FormMainFacade i_mainFacade, Enums.eFacebookObject i_facebookObject)
            {
                m_FBobjects     = new FacebookObjectCollection <FacebookObject>();
                m_mainFacade    = i_mainFacade;
                eFacebookObject = i_facebookObject;

                try
                {
                    switch (eFacebookObject)
                    {
                    case Enums.eFacebookObject.Albums:

                        foreach (Album album in m_mainFacade.GetAlbums())
                        {
                            m_FBobjects.Add(album);
                        }
                        break;

                    case Enums.eFacebookObject.Friends:
                        foreach (User friend in m_mainFacade.GetFriends())
                        {
                            m_FBobjects.Add(friend);
                        }
                        break;

                    case Enums.eFacebookObject.FavouriteTeams:
                        foreach (Page FavTeam in m_mainFacade.GetFavouriteTeams())
                        {
                            m_FBobjects.Add(FavTeam);
                        }
                        break;
                    }
                }

                catch
                {
                    throw new Facebook.FacebookApiException("No Access Or null");
                }
            }
        public FacebookObjectCollection <FacebookObjectWrapper> GetMemoriesOfFriends(bool i_IsOneDay, DateTime i_StartDate, DateTime i_EndDate, FacebookObjectCollection <User> i_FriendList)
        {
            m_StartDate = i_StartDate;
            m_FacebookObjectWrapper.Clear();

            if (i_FriendList == null)
            {
                throw new Exception(k_NoAccessMessage + "friends!");
            }
            else
            {
                try
                {
                    if (i_IsOneDay)
                    {
                        foreach (User friend in i_FriendList)
                        {
                            if (friend.Birthday == m_StartDate.Date.ToShortDateString())
                            {
                                m_FacebookObjectWrapper.Add(new FacebookObjectWrapper(friend));
                            }
                        }
                    }
                    else
                    {
                        m_EndDate = i_EndDate;

                        foreach (User friend in i_FriendList)
                        {
                            if ((friend.UpdateTime.Value.Date >= m_StartDate.Date) && (friend.UpdateTime.Value.Date <= m_EndDate.Date))
                            {
                                m_FacebookObjectWrapper.Add(new FacebookObjectWrapper(friend));
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    throw new Exception(k_NoAccessToDetailsMessage + "friend's user");
                }
            }

            if (m_FacebookObjectWrapper.Count == 0)
            {
                throw new Exception(getEmptyStringMessage("friends"));
            }

            return(m_FacebookObjectWrapper);
        }
 private void photosCheckedListBox_ItemCheck(object sender, ItemCheckEventArgs e)
 {
     if (checkedListBoxPhotos.GetItemChecked(checkedListBoxPhotos.SelectedIndex))
     {
         m_SelectedImagesCollection.Remove(
             m_FilteredPhotosCollection[checkedListBoxPhotos.SelectedIndex].ImageNormal);
     }
     else
     {
         m_SelectedImagesCollection.Add(
             m_FilteredPhotosCollection[checkedListBoxPhotos.SelectedIndex].ImageNormal);
     }
 }
예제 #22
0
        public GroupAndKnownMembers(User i_User, Group i_Group)
        {
            this.Group     = i_Group;
            m_KnownMembers = new FacebookObjectCollection <User>();

            foreach (User member in this.Group.Members)
            {
                if (memberIsAFriend(i_User, member.Name))
                {
                    m_KnownMembers.Add(member);
                }
            }
        }
예제 #23
0
        public FacebookObjectCollection <Page> GetFavouriteTeams()
        {
            FacebookObjectCollection <Page> Teams = new FacebookObjectCollection <Page>();

            if (LoggedInUser.LoggedUser.FavofriteTeams != null)
            {
                foreach (Page favTeam in LoggedInUser.LoggedUser.FavofriteTeams)
                {
                    Teams.Add(favTeam);
                }
            }
            return(Teams);
        }
예제 #24
0
        public FacebookObjectCollection <Post> GetPostsFriendTaggedUser(User i_Friend)
        {
            FacebookObjectCollection <Post> postsFriendTaggedUser = new FacebookObjectCollection <Post>();

            foreach (Post post in User.Posts)
            {
                if (post.TaggedUsers.Contains(i_Friend))
                {
                    postsFriendTaggedUser.Add(post);
                }
            }

            return(postsFriendTaggedUser);
        }
예제 #25
0
        public FacebookObjectCollection <Photo> GetMutualPictures(User i_Friend)
        {
            FacebookObjectCollection <Photo> mutualPictuers = new FacebookObjectCollection <Photo>();

            foreach (Photo photo in User.PhotosTaggedIn)
            {
                if (i_Friend.PhotosTaggedIn.Contains(photo))
                {
                    mutualPictuers.Add(photo);
                }
            }

            return(mutualPictuers);
        }
예제 #26
0
 public void FindCommon(User i_FirstUser, User i_SecUser)
 {
     m_FriendsInCommon = new FacebookObjectCollection <User>();
     foreach (User friend in i_FirstUser.Friends)
     {
         foreach (User friendOfFriend in friend.Friends)
         {
             if (friendOfFriend.Id == i_SecUser.Id)
             {
                 m_FriendsInCommon.Add(friend);
             }
         }
     }
 }
예제 #27
0
        public FacebookObjectCollection <Group> GetMutualGroups(User i_Friend)
        {
            FacebookObjectCollection <Group> mutualGroups = new FacebookObjectCollection <Group>();

            foreach (Group group in User.Groups)
            {
                if (i_Friend.Groups.Contains(group))
                {
                    mutualGroups.Add(group);
                }
            }

            return(mutualGroups);
        }
예제 #28
0
        public FacebookObjectCollection <Post> Filter(FacebookObjectCollection <Post> i_PostsToFilter, DateTime i_Threshold)
        {
            FacebookObjectCollection <Post> filteredPosts = new FacebookObjectCollection <Post>();

            foreach (Post currentPost in i_PostsToFilter)
            {
                if (m_FilterLogic.CalculateIsApprovedByThreshold(currentPost.CreatedTime, i_Threshold))
                {
                    filteredPosts.Add(currentPost);
                }
            }

            return(filteredPosts);
        }
예제 #29
0
        protected override FacebookObjectCollection <User> filterListByChoice(FacebookObjectCollection <User> i_FriendList)
        {
            FacebookObjectCollection <User> returnedList = new FacebookObjectCollection <User>();

            foreach (User friend in i_FriendList)
            {
                if (friend.Gender == User.eGender.female)
                {
                    returnedList.Add(friend);
                }
            }

            return(returnedList);
        }
        public FormCheckinList(FacebookObjectCollection <Checkin> i_Checkins, MRG.Controls.UI.LoadingCircle i_LoadingCircleShowCheckins)
        {
            m_LoadingCircleShowCheckins = i_LoadingCircleShowCheckins;
            m_Checkins = new FacebookObjectCollection <CheckinProxy>();
            foreach (Checkin checkin in i_Checkins)
            {
                m_Checkins.Add(new CheckinProxy {
                    Checkin = checkin
                });
            }

            InitializeComponent();
            initializeComponent();
        }
        protected override FacebookObjectCollection <User> filterListByChoice(FacebookObjectCollection <User> i_FriendList)
        {
            FacebookObjectCollection <User> returnedList = new FacebookObjectCollection <User>();

            foreach (User friend in i_FriendList)
            {
                if (friend.Birthday != null)
                {
                    returnedList.Add(friend);
                }
            }

            return(returnedList);
        }
예제 #32
0
        /* Fetch the Current User Photos (And return the collection)*/
        public FacebookObjectCollection <Photo> FetchUserPhotos()
        {
            FacebookObjectCollection <Photo> collectionOfUserPhotos = new FacebookObjectCollection <Photo>();

            foreach (Album album in CurrentUser?.Albums)
            {
                foreach (Photo photo in album.Photos)
                {
                    collectionOfUserPhotos.Add(photo);
                }
            }

            return(collectionOfUserPhotos);
        }
        private void buttonRespond_Click(object sender, EventArgs e)
        {
            if (comboBoxRSVPOptions.SelectedItem != null)
            {
                SelectedRSVPStatus = (Event.eRsvpType)Enum.Parse(typeof(Event.eRsvpType), comboBoxRSVPOptions.SelectedItem.ToString());

                SelectedEvents = new FacebookObjectCollection<Event>();
                foreach (object checkedEvent in checkedListBoxEvents.CheckedItems)
                {
                    SelectedEvents.Add(checkedEvent as Event);
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
예제 #34
0
        private void ApplyFiltersButton_Click_1(object sender, EventArgs e)
        {
            if (m_selectedEventForm != null)
            {
                m_selectedEventForm.Close();
            }

            FacebookObjectCollection<Event> unRepliedEvents = m_LoggedInUser.EventsNotYetReplied;
            FacebookObjectCollection<Event> filteredUnRepliedEvents = new FacebookObjectCollection<Event>();
            foreach (Event currentEvent in unRepliedEvents)
            {
                filteredUnRepliedEvents.Add(currentEvent);
            }

            foreach (Event currentEvent in unRepliedEvents)
            {
                foreach (string name in m_appConfig.EventHostBlacklist)
                {
                    if (currentEvent.Owner.Name == name)
                    {
                        filteredUnRepliedEvents.Remove(currentEvent);
                    }
                }
            }
            ListBoxUndecidedEvents.Items.Clear();
            foreach (Event currentEvent in filteredUnRepliedEvents)
            {
                ListBoxUndecidedEvents.Items.Add(currentEvent);
            }

            m_selectedEventForm = m_selectedEventForm
                .Decorate((i_Event) =>
                    MessageBox.Show(string.Format("Hosted by: {0}", i_Event.Owner.Name)),
                    (i_Event) =>
                    {
                        DialogResult dialogResult = MessageBox.Show(string.Format("Do you want to add {0} to blacklist?",i_Event.Owner.Name), string.Empty, MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            addNameToBlacklist(i_Event.Owner.Name);
                        }

                    })
                .Decorate((i_Event, i_EventOwnerBlackList) => !i_EventOwnerBlackList.Contains(i_Event.Owner.Name),
                    m_appConfig.EventHostBlacklist,
                    (i_Event) =>
                        MessageBox.Show(string.Format("You are not allowed to see events hosted by {0}",
                            i_Event.Owner.Name)));
        }