private void findAJobButton_Click(object sender, EventArgs e) { FacebookObjectCollection <AppUser> hitechWorkerContacts; listBoxJobs.Items.Clear(); try { hitechWorkerContacts = r_AppEngine.FindHitechWorkersContacts(); if (hitechWorkerContacts != null && hitechWorkerContacts.Count > 0) { FacebookView.CreateThread(() => { addAllContactsToListBox(hitechWorkerContacts); }); FriendsDisplayer displayer = new FriendsDisplayer(hitechWorkerContacts, flowLayoutPanelContactPhotos); displayer.FriendOnClickDelegate += contactPic_Click; FacebookView.CreateThread(displayer.Display); } else { MessageBox.Show("Couldnt fetch work experience."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } listBoxJobs.SelectedIndexChanged += new EventHandler(contactInfo_Click); }
private void findMeAMatchButton_Click(object sender, EventArgs e) { if (checkedGenderPreference()) { FacebookObjectCollection <AppUser> potentialMatches; setLabelsVisibility(false); try { potentialMatches = r_AppEngine.FindAMatch( checkBoxGirls.Checked, checkBoxBoys.Checked, comboBoxAgeRanges.Items[comboBoxAgeRanges.SelectedIndex].ToString()); if (potentialMatches != null && potentialMatches.Count > 0) { FriendsDisplayer displayer = new FriendsDisplayer(potentialMatches, flowLayoutPanelMatchPictures); displayer.FriendOnClickDelegate += match_Click; FacebookView.CreateThread(displayer.Display); } else { MessageBox.Show("No love for you today :("); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Please choose preferred gender."); } }
private void ShowAllDetails() { FacebookView.CreateThread(displayAlbums); FacebookView.CreateThread(fetchPosts); FacebookView.CreateThread(fetchFriends); FacebookView.CreateThread(fetchEvents); }
internal HomePanel(AppEngine i_AppEngine) : base(i_AppEngine) { InitializeComponent(); FacebookView.CreateThread(fetchInitialDetails); if (AppSettings.Settings.RememberUser) { FacebookView.CreateThread(ShowAllDetails); } }
internal void DisplayAlbums() { string albumPictureURL = string.Empty; bool hasShownExceptionMessage = false; lock (r_PanelToDisplayIn) { r_PanelToDisplayIn.Invoke(new Action(() => r_PanelToDisplayIn.Controls.Clear())); foreach (Album currentAlbum in r_AlbumsOfUser) { if (currentAlbum.Count > 0) { PictureWrapper currentAlbumPictureWrapper; PictureBox currentAlbumPictureBox; try { albumPictureURL = currentAlbum.CoverPhoto.PictureNormalURL; } catch (Facebook.FacebookApiException) { // current album has no cover photo, we handle this within PictureWrapper in the form of empty url string. } finally { try { currentAlbumPictureWrapper = new PictureWrapper(albumPictureURL); currentAlbumPictureBox = currentAlbumPictureWrapper.PictureBox; currentAlbumPictureBox.Enabled = false; currentAlbumPictureBox.Cursor = Cursors.Hand; currentAlbumPictureBox.MouseEnter += new EventHandler(album_Enter); currentAlbumPictureBox.MouseLeave += new EventHandler(album_Leave); currentAlbumPictureBox.Click += (sender, e) => { FacebookView.CreateThread(() => album_Click(currentAlbum)); }; r_PanelToDisplayIn.Invoke(new Action(() => r_PanelToDisplayIn.Controls.Add(currentAlbumPictureBox))); } catch (FacebookApiLimitException ex) { if (!hasShownExceptionMessage) { hasShownExceptionMessage = true; MessageBox.Show(ex.Message); } } } } } foreach (Control currItem in r_PanelToDisplayIn.Controls) { currItem.Enabled = true; } } }
private void match_Click(object i_sender, EventArgs e) { const int KM = 1000; FriendsDisplayer.AppUserEventArgs appUserEventArgs = e as FriendsDisplayer.AppUserEventArgs; AppUser potentialMatch; AlbumsManager matchAlbumsManager; FacebookObjectCollection <Album> matchAlbums; string profilePictureURL = string.Empty; string potentialMatchFirstName = string.Empty; string potentialMatchLastName = string.Empty; string potentialMatchCity = string.Empty; string potentialMatchBirthday = string.Empty; string distanceToMatch = string.Empty; if (appUserEventArgs != null) { potentialMatch = appUserEventArgs.User; if (potentialMatch != null) { try { IDistance distanceAdapter = r_AppEngine.DistanceBetweenTwoCoordinatesAdapter; matchAlbums = potentialMatch.GetAlbums(); if (matchAlbums != null) { matchAlbumsManager = new AlbumsManager(matchAlbums, flowLayoutPanelMatchPictures); FacebookView.CreateThread(matchAlbumsManager.DisplayAlbums); } panelUserDetailsMatch.SetDataSource(potentialMatch); double distance = distanceAdapter.GetDistanceTo( r_AppEngine.LoggedUser.Location.Latitude, r_AppEngine.LoggedUser.Location.Longitude, potentialMatch.Location.Latitude, potentialMatch.Location.Longitude); distanceToMatch = string.Format("{0:F1} km", distance / KM); labelDistanceToInfo.Invoke(new Action(() => labelDistanceToInfo.Text = distanceToMatch)); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { setLabelsVisibility(true); } } } }
internal JobPanel(AppEngine i_AppEngine) : base(i_AppEngine) { InitializeComponent(); FacebookView.CreateThread(fetchInitialDetails); }
private void albumsButton_Click(object sender, EventArgs e) { FacebookView.CreateThread(displayAlbums); }
private void friendsButton_Click(object sender, EventArgs e) { FacebookView.CreateThread(fetchFriends); }
private void postsButton_Click(object sender, EventArgs e) { FacebookView.CreateThread(fetchPosts); }