示例#1
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();
        }
示例#2
0
        public static MyPictureBoxGeneral Create(e_PictureType i_pictureType)
        {
            MyPictureBoxGeneral myPreDefinedPictureBox = null;

            switch (i_pictureType)
            {
            case e_PictureType.Album:
                myPreDefinedPictureBox = new MyPictureBoxAlbum();
                break;

            case e_PictureType.Photo:
                myPreDefinedPictureBox = new MyPictureBoxPhoto();
                break;
            }

            return(myPreDefinedPictureBox);
        }
示例#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();
        }
示例#4
0
        private void reducePhotoSizeOnMouseLeave(object sender)
        {
            MyPictureBoxPhoto pictureToEnlarge = sender as MyPictureBoxPhoto;

            pictureToEnlarge.Size = new System.Drawing.Size(200, 200);
        }
示例#5
0
        private void enlargePhotoSizeOnMouseHover(object sender)
        {
            MyPictureBoxPhoto pictureToEnlarge = sender as MyPictureBoxPhoto;

            pictureToEnlarge.Size = new System.Drawing.Size(400, 400);
        }