private void showUserLikedPages()
        {
            try
            {
                FacebookObjectCollection <Page> allLikedPages = DataManagerWrapper.DataManager.GetUserLikedPages();
                ImageList allPagesImage = getAllPagesImage(allLikedPages);
                listViewLikedPages.SmallImageList = allPagesImage;

                foreach (Page currentPage in allLikedPages)
                {
                    ListViewItem item = new ListViewItem()
                    {
                        ImageIndex = 0
                    };
                    item.SubItems.Add(currentPage.Name);
                    item.SubItems.Add(currentPage.LikesCount.ToString());
                    listViewLikedPages.Items.Add(item);
                }

                buttonLikedPages.Enabled   = false;
                listViewLikedPages.Visible = true;
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("FaceBook error! Couldn't fetch liked pages data");
            }
        }
        private void showUserPosts()
        {
            try
            {
                FacebookObjectCollection <Post> allPosts = DataManagerWrapper.DataManager.GetUserPosts();

                foreach (Post currentPost in allPosts)
                {
                    if (currentPost.Message != null)
                    {
                        ListViewItem item = new ListViewItem()
                        {
                            Text = currentPost.CreatedTime.ToString()
                        };
                        item.SubItems.Add(currentPost.Message);
                        listViewPosts.Items.Add(item);
                    }
                }

                listViewPosts.Columns[messagesColumn.Index].Width = -1;
                buttonPosts.Enabled   = false;
                listViewPosts.Visible = true;
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("FaceBook error! Couldn't fetch posts data");
            }
        }
        private void buttonFilter_Click(object sender, EventArgs e)
        {
            DataManagerWrapper.DataManager.Ride.ClearFilters();

            if (checkBoxGender.Checked)
            {
                RadioButton genderPreferenceRadioButton = groupBoxGender.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);
                DataManagerWrapper.DataManager.Ride.AddFilter(FilterFactory.GetFilter(FilterFactory.eFilter.GENDER, genderPreferenceRadioButton.Text));
            }

            if (checkBoxAge.Checked)
            {
                RadioButton agePreferenceRadioButton = groupBoxAge.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);
                DataManagerWrapper.DataManager.Ride.AddFilter(FilterFactory.GetFilter(FilterFactory.eFilter.AGE, agePreferenceRadioButton.Text));
            }

            try
            {
                ICollection <User> friendsAfterFilter = DataManagerWrapper.DataManager.Ride.Filter();
                FillFriendsResultOnDataTable(friendsAfterFilter);
            }
            catch (Exception ex)
            {
                FormFacebookApp.ShowFacebookError(ex.Message);
            }
        }
        private void fetchWorkPlaces()
        {
            try
            {
                ICollection <WorkExperience> allWorkPlaces = DataManagerWrapper.DataManager.WorkPlaces;

                if (allWorkPlaces.Count > 0)
                {
                    comboBoxWork.Invoke(new Action(() => comboBoxWork.DisplayMember = "Name"));
                    foreach (WorkExperience currWorkPlace in allWorkPlaces)
                    {
                        comboBoxWork.Invoke(new Action(() => comboBoxWork.Items.Add(currWorkPlace)));
                    }

                    comboBoxWork.Invoke(new Action(() => comboBoxWork.Enabled = true));
                }
                else
                {
                    FormFacebookApp.ShowFacebookError("There are no places where you work.");
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch your work experiences data.");
            }
        }
Exemplo n.º 5
0
        private void buttonEvent_Click(object sender, EventArgs e)
        {
            try
            {
                if (DataManagerWrapper.DataManager.GetEvents().Count > 0)
                {
                    ICollection <string> allEventsNames = DataManagerWrapper.DataManager.GetEventsNames();

                    foreach (string currEventName in allEventsNames)
                    {
                        comboBoxEvents.Items.Add(currEventName);
                    }

                    comboBoxEvents.Enabled = true;
                }
                else
                {
                    FormFacebookApp.ShowFacebookError("There are no events you go to.");
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch your events data.");
            }
        }
Exemplo n.º 6
0
        private void buttonWork_Click(object sender, EventArgs e)
        {
            try
            {
                if (DataManagerWrapper.DataManager.GetWorkExperiences() != null)
                {
                    ICollection <string> allWorkPlacesNames = DataManagerWrapper.DataManager.GetWorkPlacesNames();

                    foreach (string currWorkPlaceName in allWorkPlacesNames)
                    {
                        comboBoxWork.Items.Add(currWorkPlaceName);
                    }

                    comboBoxWork.Enabled = true;
                }
                else
                {
                    FormFacebookApp.ShowFacebookError("There are no places where you work.");
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch your work experiences data.");
            }
        }
        private void fetchEducations()
        {
            try
            {
                Education[] education = DataManagerWrapper.DataManager.Educations;
                if (education != null)
                {
                    comboBoxAcademic.Invoke(new Action(() => comboBoxAcademic.DisplayMember = "School.Name"));
                    foreach (Education currAcademicInstitution in education)
                    {
                        comboBoxAcademic.Invoke(new Action(() => comboBoxAcademic.Items.Add(currAcademicInstitution)));
                    }

                    comboBoxAcademic.Invoke(new Action(() => comboBoxAcademic.Enabled = true));
                }
                else
                {
                    FormFacebookApp.ShowFacebookError("There are no academic institutions where you study.");
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch your academic institutions data.");
            }
        }
Exemplo n.º 8
0
        private void buttonAcademicInstitution_Click(object sender, EventArgs e)
        {
            try
            {
                if (DataManagerWrapper.DataManager.GetEducations() != null)
                {
                    ICollection <string> allAcademicInstitutionsNames = DataManagerWrapper.DataManager.GetAcademicInstitutionsNames();

                    foreach (string currAcademicInstitution in allAcademicInstitutionsNames)
                    {
                        comboBoxAcademic.Items.Add(currAcademicInstitution);
                    }

                    comboBoxAcademic.Enabled = true;
                }
                else
                {
                    FormFacebookApp.ShowFacebookError("There are no academic institutions where you study.");
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch your academic institutions data.");
            }
        }
        private void fetchEvents()
        {
            try
            {
                ICollection <Event> allEvents = DataManagerWrapper.DataManager.Events;

                if (allEvents.Count > 0)
                {
                    comboBoxEvents.Invoke(new Action(() => comboBoxEvents.DisplayMember = "Name"));
                    foreach (Event currentEvent in allEvents)
                    {
                        comboBoxEvents.Invoke(new Action(() => comboBoxEvents.Items.Add(currentEvent)));
                    }

                    comboBoxEvents.Invoke(new Action(() => comboBoxEvents.Enabled = true));
                }
                else
                {
                    FormFacebookApp.ShowFacebookError("There are no events you go to.");
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch your events data.");
            }
        }
        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.");
            }
        }
 internal void ShowUserInfo()
 {
     try
     {
         this.Invoke(new Action(() => dataManagerBindingSource.DataSource = DataManagerWrapper.DataManager));
     }
     catch (Exception)
     {
         FormFacebookApp.ShowFacebookError();
     }
 }
 private void initializeRide()
 {
     try
     {
         DataManagerWrapper.DataManager.InitializeRide(m_RideFromLocationName);
     }
     catch (Exception ex)
     {
         FormFacebookApp.ShowFacebookError(ex.Message);
     }
 }
 internal void FetchUserInfo()
 {
     try
     {
         controlUserDetails.ShowUserInfo();
         showUserFriends();
     }
     catch (Exception)
     {
         FormFacebookApp.ShowFacebookError();
     }
 }
        internal static void SetDataManager(FormFacebookApp i_FacebookApp, DataManager i_DataManager)
        {
            if (DataManager == null)
            {
                m_OwnerApp = i_FacebookApp;
            }

            if (m_OwnerApp == i_FacebookApp)
            {
                DataManager = i_DataManager;
            }
        }
 private void setSelectedAlbumsPhotosOnListBox()
 {
     try
     {
         ICollection <string> selectedAlbums = checkedListBoxFilter.CheckedItems.Cast <string>().ToList();
         m_FilteredPhotosCollection = DataManagerWrapper.DataManager.GetAlbumsPhotos(selectedAlbums);
         populateCheckedListBoxPhotos();
     }
     catch (Exception)
     {
         FormFacebookApp.ShowFacebookError("Couldn't fetch albums photos data.");
     }
 }
 private void comboBoxEvents_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         ICollection <User> allFriendsFromStartPoint = DataManagerWrapper.DataManager.Ride.GetFriendsFromChosenEvent((sender as ComboBox).SelectedItem.ToString());
         controlFilter.FillFriendsResultOnDataTable(allFriendsFromStartPoint);
         controlFilter.Visible = true;
     }
     catch (Exception)
     {
         FormFacebookApp.ShowFacebookError();
     }
 }
Exemplo n.º 17
0
 private void fetchFriends()
 {
     try
     {
         foreach (User friend in DataManagerWrapper.DataManager.Friends)
         {
             checkedListBoxFilter.Invoke(new Action(() => checkedListBoxFilter.Items.Add(friend)));
         }
     }
     catch (Exception)
     {
         FormFacebookApp.ShowFacebookError("Couldn't fetch your friends data.");
     }
 }
Exemplo n.º 18
0
 private void showUserAlbums()
 {
     try
     {
         foreach (Album currentAlbum in DataManagerWrapper.DataManager.Albums)
         {
             addSingleAlbum(currentAlbum);
         }
     }
     catch (Exception)
     {
         FormFacebookApp.ShowFacebookError();
     }
 }
Exemplo n.º 19
0
 private void fetchAlbums()
 {
     try
     {
         foreach (Album album in DataManagerWrapper.DataManager.Albums)
         {
             checkedListBoxFilter.Invoke(new Action(() => checkedListBoxFilter.Items.Add(album)));
         }
     }
     catch (Exception)
     {
         FormFacebookApp.ShowFacebookError("Couldn't fetch your albums data.");
     }
 }
        internal void CreateLocationsList()
        {
            try
            {
                ICollection <string> locationsCollection = DataManagerWrapper.DataManager.SortedFriendsLocations;

                foreach (string currentLocation in locationsCollection)
                {
                    listBoxLocations.Invoke(new Action(() => listBoxLocations.Items.Add(currentLocation)));
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch your friends location data.");
            }
        }
Exemplo n.º 21
0
        private void createLocationsList()
        {
            try
            {
                ICollection <string> locationsCollection = DataManagerWrapper.DataManager.GetSortedFriendsLocation();

                foreach (string currentLocation in locationsCollection)
                {
                    listBoxLocations.Items.Add(currentLocation);
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch your friends location data.");
            }
        }
        private void showUserAlbums()
        {
            try
            {
                FacebookObjectCollection <Album> allAlbums = DataManagerWrapper.DataManager.GetAlbums();

                foreach (Album currentAlbum in allAlbums)
                {
                    addSingleAlbum(currentAlbum);
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError();
            }
        }
Exemplo n.º 23
0
 private void setSharedPhotosOnListBox()
 {
     try
     {
         ICollection <User> selectedFriends = checkedListBoxFilter.CheckedItems.Cast <User>().ToList();
         lock (r_FilteredPhotosCollectionLock)
         {
             m_FilteredPhotosCollection = DataManagerWrapper.DataManager.GetSharedFriendsPhotos(selectedFriends);
             populateCheckedListBoxPhotos();
         }
     }
     catch (Exception)
     {
         FormFacebookApp.ShowFacebookError("Couldn't fetch friends shared photos data.");
     }
 }
        private void createAlbumsCheckListBox()
        {
            try
            {
                checkedListBoxFilter.Items.Clear();
                ICollection <string> albumsNamesCollection = DataManagerWrapper.DataManager.GetAlbumsNames();

                foreach (string name in albumsNamesCollection)
                {
                    checkedListBoxFilter.Items.Add(name);
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError("Couldn't fetch your albums names data.");
            }
        }
        internal void ShowUserInfo()
        {
            try
            {
                pictureBoxUserProfile.LoadAsync(DataManagerWrapper.DataManager.GetPictureNormalURL());
                labelFirstNameData.Text = DataManagerWrapper.DataManager.GetFirstName();
                labelLastNameData.Text  = DataManagerWrapper.DataManager.GetLastName();
                labelEmailData.Text     = DataManagerWrapper.DataManager.GetEmail();
                labelBirthdayData.Text  = DataManagerWrapper.DataManager.GetBirthday();

                string daysTillBirthday = DataManagerWrapper.DataManager.GetDaysTillBirthday().ToString();
                labelDaysTillBirthdayData.Text = daysTillBirthday.Equals("0") ? "Happy Birthday!" : daysTillBirthday;
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError();
            }
        }
Exemplo n.º 26
0
        private void buttonSaveAs_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "(*.Jpeg)|*.Jpeg";

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    m_Collage.Save(saveFileDialog.FileName);
                    MessageBox.Show("Your collage saved!");
                    this.Close();
                }
                catch (Exception ex)
                {
                    FormFacebookApp.ShowFacebookError(ex.Message);
                }
            }
        }
Exemplo n.º 27
0
        private void listBoxLocations_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((sender as ListBox).SelectedItem != null)
            {
                m_RideFromLocationName = (sender as ListBox).SelectedItem.ToString();

                try
                {
                    handlePageAfterStartPointSelected();
                    DataManagerWrapper.DataManager.InitializeRide(m_RideFromLocationName);
                    FormMap map = new FormMap();
                    map.ShowLocationOnMap(m_RideFromLocationName);
                    map.ShowDialog();
                }
                catch (Exception ex)
                {
                    FormFacebookApp.ShowFacebookError(ex.Message);
                }
            }
        }
 private void buttonSeeCollage_Click(object sender, EventArgs e)
 {
     if (checkIfUserSelectedTheCorrectImagesQuantity())
     {
         try
         {
             m_AllCollagesCollection.ElementAt((int)m_FrameUserChoice).CreateCollage(m_SelectedImagesCollection);
             FormCollageView collageViewForm = new FormCollageView(m_AllCollagesCollection.ElementAt((int)m_FrameUserChoice));
             collageViewForm.ShowDialog();
         }
         catch (Exception ex)
         {
             FormFacebookApp.ShowFacebookError(ex.Message);
         }
     }
     else
     {
         FormFacebookApp.ShowFacebookError("Error! There is a mismatch between your frame choice to the number of images you selected.");
     }
 }
        internal void ShowUserFriends()
        {
            try
            {
                int counter = 0;

                this.Invoke(new Action(() => bindingSourceFriendsGrid.DataSource = DataManagerWrapper.DataManager.Friends));

                foreach (User currentUser in DataManagerWrapper.DataManager.Friends)
                {
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell()
                    {
                        Value = currentUser.Location.Name
                    };
                    dataGridViewFriends.Invoke(new Action(
                                                   () => dataGridViewFriends.Rows[counter].Cells[locationColumn.Index] = cell));
                    counter++;
                }
            }
            catch (Exception ex)
            {
                FormFacebookApp.ShowFacebookError(ex.Message);
            }
        }
        private void showUserFriends()
        {
            try
            {
                FacebookObjectCollection <User> allFriends = DataManagerWrapper.DataManager.GetFriends();
                int counter = 0;

                bindingSourceFriendsGrid.DataSource = allFriends;

                foreach (User currentUser in allFriends)
                {
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell()
                    {
                        Value = currentUser.Location.Name
                    };
                    dataGridViewFriends.Rows[counter].Cells[locationColumn.Index] = cell;
                    counter++;
                }
            }
            catch (Exception)
            {
                FormFacebookApp.ShowFacebookError();
            }
        }