public void PlaySlideShow()
 {
     UILogicHelper.MakeControlsVisible(stopButton);
     UILogicHelper.MakeControlsInvisible(playButton);
     timerForSlideShow.Enabled = true;
     m_AudioPlayer.Play();
 }
 // Chosing album in listbox
 public void FillPanel(IAlbumOperable i_FormToFill)
 {
     UILogicHelper.MakeControlsInvisible(i_FormToFill.ListBoxAlbums);
     i_FormToFill.PhotosAlbum = i_FormToFill.UsersAlbums.ElementAt(i_FormToFill.ListBoxAlbums.SelectedIndex);
     fillPanelByPhotos(i_FormToFill);
     UILogicHelper.MakeControlsVisible(i_FormToFill.ButtonSlideshow);
 }
 private void stopSlideShow()
 {
     UILogicHelper.MakeControlsVisible(playButton);
     UILogicHelper.MakeControlsInvisible(stopButton);
     timerForSlideShow.Enabled = false;
     m_AudioPlayer.Stop();
 }
 private void onKeyDownHandler(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         FriendsFacade.PostStatus(textBoxPostFriend.Text);
         UILogicHelper.MakeControlsInvisible(textBoxPostFriend);
         MessageBox.Show("Your post was successfully post.");
     }
 }
 private void makeLocalComponentsVisible()
 {
     this.Invoke(new Action(() =>
     {
         UILogicHelper.MakeControlsInvisible(buttonLogin);
         UILogicHelper.MakeControlsVisible(labelHelloUser, buttonLogout, pictureBoxUser, buttonShowFriends,
                                           buttonMyPosts, buttonMakePost, buttonAlbums);
     }));
 }
 // Logout From Account
 private void buttonLogout_Click(object sender, EventArgs e)
 {
     // Calling method doLogout
     m_Facade.LogOut();
     closeAllComponents();
     UILogicHelper.MakeControlsVisible(buttonLogin);
     UILogicHelper.MakeControlsInvisible(buttonLogout, pictureBoxUser, buttonShowFriends,
                                         labelHelloUser, buttonMyPosts, buttonMakePost, textBoxPost, buttonAlbums);
 }
 private void closeAllComponents()
 {
     this.Invoke(new Action(() =>
     {
         UILogicHelper.MakeControlsInvisible(createdTimeLabel, createdTimeLabel1, imageAlbumLabel,
                                             imageAlbumPictureBox, nameLabel, nameLabel1, forAlbumsListBoxLabel, listBoxCommonGroups,
                                             listBoxMutualFriends, listBoxFriendAlbums, textBoxPostFriend, labelAlbumName, panelPhotos,
                                             buttonSlideshow, labelFriendInfo);
     }));
 }
 private void closeAllComponents()
 {
     this.Invoke(new Action(() =>
     {
         UILogicHelper.MakeControlsInvisible(createdTimeLabel, createdTimeLabel1, imageAlbumLabel,
                                             imageAlbumPictureBox, nameLabel, nameLabel1, forFriendsListBoxLabel, forAlbumsListBoxLabel,
                                             pictureBoxLargeFoto, buttonClosePicture, textBoxPost, listBoxAlbums, listBoxFriends,
                                             panelPhotos, labelAlbumName, buttonSlideshow);
     }));
 }
        private void showCommonGroups()
        {
            List <string> commonGroups = null;

            closeAllComponents();
            UILogicHelper.MakeControlsVisible(listBoxCommonGroups);
            new Thread(() =>
            {
                commonGroups = FriendsFacade.FindCommonGroups();
                fillListBox(listBoxMutualFriends, commonGroups, r_NoCommonGroups);
            }).Start();
        }
 private void showAlbums()
 {
     closeAllComponents();
     this.Invoke(new Action(() =>
     {
         UILogicHelper.MakeControlsVisible(forAlbumsListBoxLabel, createdTimeLabel, createdTimeLabel1,
                                           imageAlbumLabel, imageAlbumPictureBox, nameLabel, nameLabel1, forAlbumsListBoxLabel);
     }));
     ListBoxAlbums = listBoxFriendAlbums;
     UsersAlbums   = FriendsFacade.GetUserAlbums();
     m_AlbumOperator.ShowAlbums(this, albumBindingSource);
 }
 public void ShowAlbums(IAlbumOperable i_FormToFill, BindingSource io_AlbumBindingSource)
 {
     i_FormToFill.ListBoxAlbums.Invoke(new Action(
                                           () =>
     {
         UILogicHelper.MakeControlsVisible(i_FormToFill.ListBoxAlbums);
         i_FormToFill.ListBoxAlbums.BringToFront();
         if (i_FormToFill.UsersAlbums.Count > 0)
         {
             io_AlbumBindingSource.DataSource = i_FormToFill.UsersAlbums;
         }
     }));
 }
 private void fillPostPanel(FacebookObjectCollection <Post> i_Posts)
 {
     loadingLabel.Invoke(new Action(() => UILogicHelper.MakeControlsInvisible(loadingLabel)));
     foreach (Post post in i_Posts)
     {
         if (post != null)
         {
             Panel panel = generatePostPanel();
             addPostComponentsToPanel(panel, post.Comments, post.CreatedTime, post.From, post.LikedBy, post.Message,
                                      post.PictureURL, post.Place, post.TaggedUsers);
             m_CurrPostPanelLocationY += panel.Height + 15;
             this.Invoke(new Action(() => this.Controls.Add(panel)));
         }
     }
 }
        private void fillPanelByPhotos(IAlbumOperable i_FormToFill)
        {
            int index = 0;

            LazyPictureBox[] albumPictureBoxes = new LazyPictureBox[i_FormToFill.PhotosAlbum.Photos.Count];
            double           panelWidth        = i_FormToFill.PhotosPanel.Width;
            int   pictureWidth        = (int)(panelWidth / 3);
            int   pictureHeigt        = pictureWidth;
            Point currPictureLocation = new Point(i_FormToFill.PhotosPanel.Location.X, i_FormToFill.PhotosPanel.Location.Y);

            i_FormToFill.PhotosPanel.Controls.Clear();
            UILogicHelper.MakeControlsVisible(i_FormToFill.PhotosPanel, i_FormToFill.AlbumNameLabel);
            i_FormToFill.PhotosPanel.AutoScroll = true;
            i_FormToFill.AlbumNameLabel.Text    = i_FormToFill.PhotosAlbum.Name;
            foreach (Photo photo in i_FormToFill.PhotosAlbum.Photos)
            {
                //check with static index: this for delete photoSerialNum
                albumPictureBoxes[index] = new LazyPictureBox();
                int photoSerialNum = index;
                albumPictureBoxes[index].Click += (sender, e) => RunPictureShower(i_FormToFill.PhotosAlbum,
                                                                                  (sender as PictureBox).Image, photoSerialNum);
                albumPictureBoxes[index].Location = currPictureLocation;
                albumPictureBoxes[index].Size     = new Size(pictureWidth, pictureHeigt);
                albumPictureBoxes[index].SizeMode = PictureBoxSizeMode.StretchImage;
                i_FormToFill.PhotosPanel.Controls.Add(albumPictureBoxes[index]);
                currPictureLocation = new Point(currPictureLocation.X + pictureWidth, currPictureLocation.Y);
                index++;
                if ((index) % 3 == 0)
                {
                    currPictureLocation = new Point(i_FormToFill.PhotosPanel.Location.X, currPictureLocation.Y + pictureHeigt);
                }
            }

            index = 0;
            new Thread(() =>
            {
                foreach (Photo photo in i_FormToFill.PhotosAlbum.Photos)
                {
                    albumPictureBoxes[index++].Load(photo.PictureNormalURL);
                }
            }).Start();
        }
 private void showFriends()
 {
     closeAllComponents();
     listBoxFriends.Invoke(new Action(
                               () =>
     {
         listBoxFriends.Items.Clear();
         UILogicHelper.MakeControlsVisible(listBoxFriends, forFriendsListBoxLabel);
         if (m_Facade.GetFriendsNumber() > 0)
         {
             foreach (String friend in m_Facade)
             {
                 listBoxFriends.Items.Add(friend);
             }
         }
         else
         {
             listBoxFriends.Items.Add(r_NoFriendsMessage);
         }
     }));
 }
 // Post on Friend's Timeline
 private void buttonPostToFriend_Click(object sender, EventArgs e)
 {
     closeAllComponents();
     textBoxPostFriend.Text = "Enter your post";
     UILogicHelper.MakeControlsVisible(textBoxPostFriend);
 }
 // Profile Picture Clicking
 private void pictureBoxUser_Click(object sender, EventArgs e)
 {
     closeAllComponents();
     pictureBoxLargeFoto.LoadAsync(m_Facade.GetBigProfilePicture());
     UILogicHelper.MakeControlsVisible(buttonClosePicture, pictureBoxLargeFoto);
 }