private void dispatchItems(FacebookObjectCollection <IPictureAndNameOwner> i_JoinedItems) { if (m_OnItemsFind != null) { m_OnItemsFind.Invoke(i_JoinedItems); } }
private void fetchSingleFriendsLists() { User fullFriend; bool isSingleFriend; bool isMaleFriend; FacebookObjectCollection <User> friends = m_Manger.FetchMyfriends(); foreach (User friend in friends) { fullFriend = FacebookService.GetObject <User>(friend.Id, User.s_FieldsToLoadFull[DynamicWrapper.eLoadOptions.Full]); isSingleFriend = isFriendSingle(fullFriend); if (isSingleFriend == true) { isMaleFriend = isFriendMale(fullFriend); if (isMaleFriend == true) { listBoxMaleSingleFriends.Items.Add(fullFriend); } else { listBoxFemaleSingleFriends.Items.Add(fullFriend); } } } }
public List <ActiveCommentator> GetActiveCommentatorsList(FacebookObjectCollection <Post> i_Posts) { List <ActiveCommentator> activeCommentatorsList = new List <ActiveCommentator>(); foreach (Post post in i_Posts) { foreach (Comment comment in post.Comments) { bool ifExists = false; foreach (ActiveCommentator activeCommentator in activeCommentatorsList) { if (comment.From.Id.Equals(activeCommentator.UserId)) { ifExists = true; encreaseNumber(activeCommentator); break; } } if (!ifExists) { IActiveUser activeUser = ActiveUserCreator.CreateActiveUser(comment.GetType()); activeUser.UserName = comment.From.Name; activeUser.UserId = comment.From.Id; activeCommentatorsList.Add(activeUser as ActiveCommentator); } } } return(activeCommentatorsList); }
public FacebookObjectCollection <User> FilterByYearDifference(int i_SelectedValue) { FacebookObjectCollection <User> resCollection = new FacebookObjectCollection <User>(); if (LoggedUser != null) { string birthday = LoggedUser.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 LoggedUser.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_SelectedValue || friendYearOfBirth == yearOfBirth + i_SelectedValue) { resCollection.Add(friend); } } } } return(resCollection); }
public List <ActiveLiker> GetActiveLikersList(FacebookObjectCollection <Post> i_Posts) { List <ActiveLiker> activeLikersList = new List <ActiveLiker>(); foreach (Post post in i_Posts) { foreach (User liker in post.LikedBy) { bool ifExists = false; foreach (ActiveLiker activeLiker in activeLikersList) { if (liker.Id.Equals(activeLiker.UserId)) { ifExists = true; encreaseNumber(activeLiker); break; } } if (!ifExists) { IActiveUser activeUser = ActiveUserCreator.CreateActiveUser(liker.GetType()); activeUser.UserName = liker.Name; activeUser.UserId = liker.Id; activeLikersList.Add(activeUser as ActiveLiker); } } } return(activeLikersList); }
public void LoadFacebookCollection <T>(FacebookObjectCollection <T> i_FacebookObjectCollection, Size i_PictureSize) where T : FacebookObject { foreach (T facebookObject in i_FacebookObjectCollection) { m_DescriptivePicturesSpreader.Add(DescriptivePictureFactory.CreateDescriptivePicture(facebookObject as T, i_PictureSize)); } }
public FormAlbums(FacebookObjectCollection <Album> i_Albums, MRG.Controls.UI.LoadingCircle i_LoadingCircleShowMyAlbums) { r_Albums = i_Albums; m_LoadingCircleShowMyAlbums = i_LoadingCircleShowMyAlbums; InitializeComponent(); albumBindingSource.DataSource = r_Albums; }
public FormFriendList(FacebookObjectCollection <User> i_friends, MRG.Controls.UI.LoadingCircle i_LoadingCircleShowFriend) { r_Friends = i_friends; m_LoadingCircleShowFriend = i_LoadingCircleShowFriend; InitializeComponent(); initializeComponent(); }
private void showUserLikedPages() { try { FacebookObjectCollection <Page> allLikedPages = DataManagerWrapper.DataManager.UserLikedPages; getAllPagesImage(allLikedPages); foreach (Page currentPage in allLikedPages) { ListViewItem item = new ListViewItem() { ImageIndex = 0 }; item.SubItems.Add(currentPage.Name); item.SubItems.Add(currentPage.LikesCount.ToString()); listViewLikedPages.Invoke(new Action(() => listViewLikedPages.Items.Add(item))); } buttonLikedPages.Invoke(new Action(() => buttonLikedPages.Enabled = false)); listViewLikedPages.Invoke(new Action(() => listViewLikedPages.Visible = true)); } catch (Exception) { FormFacebookApp.ShowFacebookError("FaceBook error! Couldn't fetch liked pages data"); } }
public FormEventsList(FacebookWrapper.ObjectModel.FacebookObjectCollection <FacebookWrapper.ObjectModel.Event> i_Events, MRG.Controls.UI.LoadingCircle i_LoadingCircleShowEvents) { m_Events = i_Events; m_LoadingCircleShowEvents = i_LoadingCircleShowEvents; InitializeComponent(); eventBindingSource.DataSource = m_Events; }
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); }
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 monthOfBirth = int.Parse(string.Format("{0}{1}", birthday[3], birthday[4])); int friendMonthOfBirth; foreach (User friend in i_FilterBy.User.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); }
private void onFetchedFriendsCompleted(FacebookObjectCollection <User> friends) { foreach (User friend in friends) { listBoxFriends.Invoke(new Action(() => listBoxFriends.Items.Add(friend))); } }
private void fetchPostsLikers() { m_UsersDictionary = new Dictionary <string, User>(); m_LikesCounterDictionary = new Dictionary <string, int>(); try { FacebookObjectCollection <Post> UserPosts = m_User.Posts; if (UserPosts != null) { foreach (Post post in UserPosts) { if (post.Message != null) { foreach (User friend in post.LikedBy) { if (!m_LikesCounterDictionary.ContainsKey(friend.Id)) { m_LikesCounterDictionary.Add(friend.Id, -1); m_UsersDictionary.Add(friend.Id, friend); } else { m_LikesCounterDictionary[friend.Id]--; } } } } } } catch (Exception ex) { // don't do nothing when we are loging out at the mainThread } }
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); }
public void setPropertiesToFacadeObjects() { ListFriendName = m_logic.ListFriendName; UserEventsCollection = m_logic.UserEventsCollection; UserLikedPagesCollection = m_logic.UserLikedPagesCollection; UserAlbumsCollection = m_logic.UserAlbumsCollection; }
public List <Post> search(FacebookObjectCollection <Post> userPosts, string searchedValue) { List <Post> values = new List <Post>(); PostsWithLocationCollection postsWithLocationCollection = new PostsWithLocationCollection(userPosts); PostsWithLocationIterator postsIterator = postsWithLocationCollection.GetIterator(); while (postsIterator.MoveNext()) { Post post = postsIterator.Current(); string location = post.Place.Location.City.ToLower(); if (searchedValue.Equals(location)) { values.Add(post); } } /* * foreach (Post post in userPosts) * { * if (post.Place != null && post.Place.Location != null && post.Place.Location.City != null) * { * string location = post.Place.Location.City.ToLower(); * if (searchedValue.Equals(location)) * { * values.Add(post); * } * } * } */ return(values); }
private void showUserPosts() { try { FacebookObjectCollection <Post> allPosts = DataManagerWrapper.DataManager.UserPosts; foreach (Post currentPost in allPosts) { if (currentPost.Message != null) { ListViewItem item = new ListViewItem() { Text = currentPost.CreatedTime.ToString() }; item.SubItems.Add(currentPost.Message); listViewPosts.Invoke(new Action(() => listViewPosts.Items.Add(item))); } } listViewPosts.Invoke(new Action(() => listViewPosts.Columns[messagesColumn.Index].Width = -1)); buttonPosts.Invoke(new Action(() => buttonPosts.Enabled = false)); listViewPosts.Invoke(new Action(() => listViewPosts.Visible = true)); } catch (Exception) { FormFacebookApp.ShowFacebookError("FaceBook error! Couldn't fetch posts data"); } }
private void findFans() { uiThreadInvoke(() => loadingLabel.Visible = true); FacebookObjectCollection <Album> albums = LoggedInUser.Albums; List <Photo> photos = new List <Photo>(); foreach (Album album in albums) { foreach (Photo photo in album.Photos) { if (photo.LikedBy.Count > 0) { photos.Add(photo); } } } Dictionary <User, int> usersToLikes = new Dictionary <User, int>(); foreach (Photo photo in photos) { updateDictionary(photo.LikedBy, usersToLikes); } List <KeyValuePair <User, int> > listToSort = usersToLikes.ToList(); listToSort.Sort((pair1, pair2) => pair2.Value.CompareTo(pair1.Value)); uiThreadInvoke(() => { fanBindingSource.DataSource = listToSort.Select(kvp => new Fan(kvp.Key, kvp.Value)); fanDisplayPanel.Visible = true; loadingLabel.Visible = false; }); }
public static string CalcStatistics(FacebookObjectCollection <Status> i_UserStatuses) { Flag = false; // Make sure we initiate this procedure only once if (m_preferredMonth == null || m_preferredHour == null || m_preferredDay == null) { // Init arrays as hash tables int[] hours = new int[24]; int[] days = new int[7]; int[] months = new int[12]; foreach (var status in i_UserStatuses) { DateTime time = Convert.ToDateTime(status.CreatedTime); days[(int)time.DayOfWeek] += status.LikedBy.Count; hours[time.Hour] += status.LikedBy.Count; months[time.Month - 1] += status.LikedBy.Count; } m_preferredDay = s_WeekDayStringArray[Utilities.FindIndexOfMaxValueInArray(days)]; m_preferredMonth = s_MonthNameStringArray[Utilities.FindIndexOfMaxValueInArray(months)]; m_preferredHour = Utilities.HoursToAmPm(Utilities.FindIndexOfMaxValueInArray(hours)); } // Generate final string string finalStr = "According to your statuses statistics we found that:" + Environment.NewLine + "Usualy on " + m_preferredDay + "s you get the most likes." + Environment.NewLine + "Time-wise, " + m_preferredHour + " is the best time" + Environment.NewLine + "and " + m_preferredMonth + " is the best month."; Flag = false; return(finalStr); }
private void getCurrentEvents(out FacebookObjectCollection <Event> o_Events, eEventsType i_EventsType) { o_Events = null; switch (i_EventsType) { case eEventsType.Attending: { o_Events = m_LoggedInUser.EventsCreated; break; } case eEventsType.Maybe: { o_Events = m_LoggedInUser.EventsMaybe; break; } case eEventsType.NotAttending: { o_Events = m_LoggedInUser.EventsDeclined; break; } case eEventsType.NotRepliad: { o_Events = m_LoggedInUser.EventsNotYetReplied; break; } } }
public void RateBy() { if (IsEmpty.Invoke()) { string userId = m_UserId; try { foreach (T1 item in m_Items) { FacebookObjectCollection <T2> items = MethodOne(item); if (items.Count != 0) { MethodTwo.Invoke(items, userId, m_ScoreValue); } } } catch (Exception e) { if (Exception == null) { Exception = e; } } } }
private void userRateByGoingSameEvents() { if (r_ServerInformation.IsEventsEmpty()) { string userId = getUserId(); try { foreach (Event events in r_ServerInformation.GetEvents()) { FacebookObjectCollection <User> userEvent = r_ServerInformation.AddUserListEvents(events.AttendingUsers); if (userEvent.Count != 0) { foreach (User user in userEvent) { if (user.Id != userId) { r_ServerInformation.AddUserRateToDictinary(userId, 1); } } } } } catch (Exception e) { if (m_Exception == null) { m_Exception = e; } } } /* permission error */ }
public static string CalcStatistics(FacebookObjectCollection<Status> i_UserStatuses) { Flag = false; // Make sure we initiate this procedure only once if (m_preferredMonth == null || m_preferredHour == null || m_preferredDay == null) { // Init arrays as hash tables int[] hours = new int[24]; int[] days = new int[7]; int[] months = new int[12]; foreach (var status in i_UserStatuses) { DateTime time = Convert.ToDateTime(status.CreatedTime); days[(int)time.DayOfWeek] += status.LikedBy.Count; hours[time.Hour] += status.LikedBy.Count; months[time.Month-1] += status.LikedBy.Count; } m_preferredDay = s_WeekDayStringArray[Utilities.FindIndexOfMaxValueInArray(days)]; m_preferredMonth = s_MonthNameStringArray[Utilities.FindIndexOfMaxValueInArray(months)]; m_preferredHour = Utilities.HoursToAmPm(Utilities.FindIndexOfMaxValueInArray(hours)); } // Generate final string string finalStr = "According to your statuses statistics we found that:" + Environment.NewLine + "Usualy on " + m_preferredDay + "s you get the most likes." + Environment.NewLine + "Time-wise, " + m_preferredHour + " is the best time" + Environment.NewLine + "and " + m_preferredMonth + " is the best month."; Flag = false; return finalStr; }
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); }
public void FindMatch(User i_LoggedInUser) { FacebookObjectCollection <User> friendsOfUser = i_LoggedInUser.Friends; Dictionary <User, int> likesOfFriendsList = new Dictionary <User, int>(); foreach (Album album in i_LoggedInUser.Albums) { foreach (Photo photo in album.Photos) { foreach (User user in photo.LikedBy) { if (likesOfFriendsList.ContainsKey(user)) { likesOfFriendsList[user]++; } else { likesOfFriendsList.Add(user, 1); } } } } KeyValuePair <User, int> theMostLikerFriend = new KeyValuePair <User, int>(null, 0); foreach (KeyValuePair <User, int> likesOfFriend in likesOfFriendsList) { if (likesOfFriend.Value > theMostLikerFriend.Value) { theMostLikerFriend = likesOfFriend; } } BestMatch = theMostLikerFriend.Key; }
private void setAllPhotosOnListBox() { try { lock (r_FilteredPhotosCollectionLock) { m_FilteredPhotosCollection = new FacebookObjectCollection <Photo>(); int nodeCouner = 0; foreach (Album album in DataManagerWrapper.DataManager.Albums) { int photoCounter = 1; foreach (Photo photo in album.Photos) { checkedListBoxPhotos.Invoke( new Action(() => 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."); } }
public void AddEvents(FacebookObjectCollection <Event> i_EventsToAdd) { foreach (Event e in i_EventsToAdd) { AddEvent(e); } }
private void loadFriends() { try { listBoxFriends.Invoke(new Action(() => { listBoxFriends.Items.Clear(); listBoxFriends.DisplayMember = "Name"; })); FacebookObjectCollection <User> friendsList = m_ConnectedUser.Friends; foreach (User friend in friendsList) { listBoxFriends.Invoke(new Action(() => listBoxFriends.Items.Add(friend))); } if (friendsList.Count == 0) { MessageBox.Show("No Friends to retrieve :("); } } catch { MessageBox.Show("An error occured while fetching user's friends."); } }
public FormAlbums(FacebookObjectCollection <Album> i_Albums) { r_Albums = i_Albums; m_AlbumIndex = 0; InitializeComponent(); //desginer code initializeComponent(); //our code }
public List <string> ListOfCommonCheckins(FacebookObjectCollection <Checkin> i_CheckinsOfFriend) { List <string> commonCheckins = new List <string>(); try { foreach (Checkin loggenInUserCheckins in m_LoggedInUser.LoggedInUser.Checkins) { foreach (Checkin friendCheckins in i_CheckinsOfFriend) { if (loggenInUserCheckins.Place.Name.Equals(friendCheckins.Place.Name)) { commonCheckins.Add(loggenInUserCheckins.Place.Name.ToString()); break; } } } } catch (Exception) { commonCheckins.Add("sorry, cant get checkins"); } if (commonCheckins.Count == 0) { commonCheckins.Add("no common checkins"); } return(commonCheckins); }
private void initUserGroups(FacebookObjectCollection<Group> i_LoggedInUserGroups) { m_LoggedInUserGroups = new List<Group>(); foreach (Group group in i_LoggedInUserGroups) { LoggedInUserGroups.Add(group); } }
private void initFriends() { Friends = new FacebookObjectCollection<User>(); foreach (User user in m_User.Friends) { Friends.Add(user); } }
private void initUpcomingEvents() { UpcomingEvents = new FacebookObjectCollection<Event>(); foreach (Event eve in m_User.EventsNotYetReplied) { //if (eve.EndTime > DateTime.Now) { UpcomingEvents.Add(eve); } } }
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(); } }
public FacebookObjectCollection<Album> Sort(FacebookObjectCollection<Album> i_albums) { FacebookObjectCollection<Album> tempAlbum = i_albums; Album curr; Album nxt; for (int i = 0; i < i_albums.Count - 1; i++) { for (int j = 0; j < i_albums.Count - 1; j++) { curr = i_albums[j]; nxt = i_albums[j + 1]; if (curr.CreatedTime > nxt.CreatedTime) { tempAlbum.Move(j, j + 1); } } } return tempAlbum; }
private void initChakBoxVal(FacebookObjectCollection<Event> i_FacebookObjectCollection) { checkedListBoxEvents.DisplayMember = "Name"; foreach (Event fbEvent in i_FacebookObjectCollection) { if (fbEvent.StartTime != null && (DateTime.Now.CompareTo(fbEvent.StartTime) < 0)) { checkedListBoxEvents.Items.Add(fbEvent); checkedListBoxEvents.SetItemChecked(checkedListBoxEvents.Items.Count - 1, true); } } comboBoxRSVPOptions.Items.AddRange(Enum.GetNames(typeof(Event.eRsvpType)) as string[]); if (checkedListBoxEvents.Items.Count == 0) { MessageBox.Show("No pending events to show."); } }
public FriendsBirthdayFacade(FacebookObjectCollection<User> i_Friends) { FriendsBirthdays = new FriendsBirthdays(i_Friends); }
public FormEventResponder(FacebookObjectCollection<Event> i_FacebookObjectCollection) { InitializeComponent(); initChakBoxVal(i_FacebookObjectCollection); }
public FacebookUserProfile(FacebookObjectCollection<User> i_Friends) { Friends = i_Friends; }
// Constructor - Init the real Multi Group Post Feature and init the cache Queue public MultiGroupFeatureProxy(FacebookObjectCollection<Group> i_LoggedInUserGroups) { MultiGroupPost = new MultipleGroupPostFeature(i_LoggedInUserGroups); MultiPostObjectsCache = new Queue<MultiPostObject>(); }
public FriendsBirthdays(FacebookObjectCollection<User> i_Friends) { m_Friends = i_Friends; }
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))); }
public AlbumPhotosIterator(FacebookObjectCollection<Photo> i_Collection) { m_Collection = i_Collection; m_Count = m_Collection.Count; }
public MultipleGroupPostFeature(FacebookObjectCollection<Group> i_LoggedInUserGroups) { initUserGroups(i_LoggedInUserGroups); }