示例#1
0
        private void fetchAlbums()
        {
            FormUserAlbums formUserAlbums = new FormUserAlbums();

            formUserAlbums.StartPosition = FormStartPosition.CenterParent;

            int x        = 0;
            int y        = 0;
            int xCounter = 5;

            foreach (Album userAlbum in this.m_LoggedInUser.Albums)
            {
                if (userAlbum.CoverPhoto != null)
                {
                    MyPictureBoxAlbum thePictureBoxAlbumIWant = MyPictureBoxGeneral.Create(MyPictureBoxGeneral.e_PictureType.Album) as MyPictureBoxAlbum;
                    thePictureBoxAlbumIWant.Album = userAlbum;
                    Label albumNameLabel = new Label();

                    thePictureBoxAlbumIWant.Location = new Point(x, y);
                    thePictureBoxAlbumIWant.Size     = new Size(150, 150);
                    thePictureBoxAlbumIWant.SizeMode = PictureBoxSizeMode.StretchImage;
                    thePictureBoxAlbumIWant.LoadAsync(userAlbum.CoverPhoto.URL);
                    thePictureBoxAlbumIWant.Click += (object sender, EventArgs e) =>
                    {
                        this.fetchPhotosFromSpecificAlbum(sender);
                    };

                    thePictureBoxAlbumIWant.BorderStyle = BorderStyle.Fixed3D;
                    albumNameLabel.AutoSize             = false;
                    albumNameLabel.Size        = new Size(150, 20);
                    albumNameLabel.Text        = string.Format(@"Album Name: {0}", thePictureBoxAlbumIWant.Album.Name);
                    albumNameLabel.Location    = new Point(thePictureBoxAlbumIWant.Left, thePictureBoxAlbumIWant.Bottom + 2);
                    albumNameLabel.Font        = new System.Drawing.Font(new FontFamily("Microsoft Sans Serif"), 7f, FontStyle.Regular);
                    albumNameLabel.MouseEnter += (object sender, EventArgs e) =>
                    {
                        this.m_IsAutoSize = true;
                        this.modifyingAlbumName(sender, new System.Drawing.Font(new FontFamily("Microsoft Sans Serif"), 9f, FontStyle.Bold), this.m_IsAutoSize);
                    };

                    albumNameLabel.MouseLeave += (object sender, EventArgs e) =>
                    {
                        this.m_IsAutoSize = false;
                        this.modifyingAlbumName(sender, new System.Drawing.Font(new FontFamily("Microsoft Sans Serif"), 7f, FontStyle.Regular), this.m_IsAutoSize);
                    };

                    formUserAlbums.Controls.Add(thePictureBoxAlbumIWant);
                    formUserAlbums.Controls.Add(albumNameLabel);
                    x += 160;
                    xCounter--;
                    if (xCounter == 0)
                    {
                        x        = 0;
                        xCounter = 5;
                        y       += 184;
                    }
                }
            }

            formUserAlbums.ShowDialog();
        }
示例#2
0
        ////Once creating an album (or just creating a profile) photos will be automatically added as a default cover of the album. therefore we did not check for empty (null) content.
        private void fetchPhotosFromSpecificAlbum(object sender)
        {
            MyPictureBoxAlbum currentAlbum = sender as MyPictureBoxAlbum;

            List <MyPictureBoxGeneral> collectionOfPictureBoxPhotos = new List <MyPictureBoxGeneral>();

            foreach (Photo photoFromAlbum in currentAlbum.Album.Photos)
            {
                MyPictureBoxPhoto thePictureBoxPhotoIWant = MyPictureBoxGeneral.Create(MyPictureBoxGeneral.e_PictureType.Photo) as MyPictureBoxPhoto;
                thePictureBoxPhotoIWant.Photo = photoFromAlbum;
                collectionOfPictureBoxPhotos.Add(thePictureBoxPhotoIWant);
            }

            int j = 0;

            foreach (MyPictureBoxGeneral picture in collectionOfPictureBoxPhotos)
            {
                if (j + 1 < collectionOfPictureBoxPhotos.Count)
                {
                    collectionOfPictureBoxPhotos.ElementAt <MyPictureBoxGeneral>(j).SetNext(collectionOfPictureBoxPhotos.ElementAt <MyPictureBoxGeneral>(j + 1));
                }

                j++;
            }

            FormSlideShow slideShow = new FormSlideShow();

            slideShow.PictureBoxToSet = collectionOfPictureBoxPhotos.ElementAt <MyPictureBoxGeneral>(0);
            slideShow.ShowDialog();
        }
示例#3
0
        ////Once creating an album (or just creating a profile) photos will be automatically added as a default cover of the album. therefore we did not check for empty (null) content.
        private void fetchPhotosFromSpecificAlbum(object sender)
        {
            MyPictureBoxAlbum currentAlbum = sender as MyPictureBoxAlbum;

            int x        = 0;
            int y        = 0;
            int xCounter = 5;

            FormPhotosFromAlbum formPhotosFromAlbum = new FormPhotosFromAlbum();

            formPhotosFromAlbum.StartPosition = FormStartPosition.CenterParent;

            foreach (Photo photoFromAlbum in currentAlbum.Album.Photos)
            {
                MyPictureBoxPhoto thePictureBoxPhotoIWant = MyPictureBoxGeneral.Create(MyPictureBoxGeneral.e_PictureType.Photo) as MyPictureBoxPhoto;
                thePictureBoxPhotoIWant.Photo    = photoFromAlbum;
                thePictureBoxPhotoIWant.Location = new Point(x, y);
                thePictureBoxPhotoIWant.Size     = new Size(200, 200);
                thePictureBoxPhotoIWant.SizeMode = PictureBoxSizeMode.StretchImage;
                thePictureBoxPhotoIWant.LoadAsync(photoFromAlbum.URL);

                thePictureBoxPhotoIWant.MouseEnter += (object send, EventArgs e) =>
                {
                    this.enlargePhotoSizeOnMouseHover(send);
                };

                thePictureBoxPhotoIWant.MouseLeave += (object send, EventArgs e) =>
                {
                    this.reducePhotoSizeOnMouseLeave(send);
                };

                formPhotosFromAlbum.Controls.Add(thePictureBoxPhotoIWant);
                x += 220;
                xCounter--;
                if (xCounter == 0)
                {
                    x        = 0;
                    xCounter = 5;
                    y       += 220;
                }
            }

            formPhotosFromAlbum.ShowDialog();
        }