Inheritance: System.Windows.Forms.UserControl
Exemplo n.º 1
0
        private void RefreshAlbumsView()
        {
            foreach (Control ctrl in this.panelAlbums.Controls)
            {
                if (ctrl is AlbumIcon)
                {
                    this.panelAlbums.Controls.Remove(ctrl);
                }
            }

            if (this.GalleryObjectSource != null)
            {
                if (this.GalleryObjectSource.Albums != null)
                {
                    int nextLocation = topMargin;

                    foreach (Album alb in this.GalleryObjectSource.Albums)
                    {
                        AlbumIcon albico = new AlbumIcon();
                        albico.Size        = new Size(widthAlbumObject, heightAlbumObject);
                        albico.Location    = new Point(leftMargin, nextLocation);
                        albico.Visible     = true;
                        albico.AlbumClick += new AlbumIcon.AlbumIconClick(AlbumIcon_Click);
                        albico.AlbumObject = alb;

                        this.panelAlbums.Controls.Add(albico);

                        nextLocation += heightAlbumObject + topMargin;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = sender as ToolStripMenuItem;

            if (menuItem != null)
            {
                ContextMenuStrip albumMenu = menuItem.Owner as ContextMenuStrip;

                if (albumMenu != null)
                {
                    Control controlSelected = albumMenu.SourceControl;

                    if (controlSelected is PhotoIcon)
                    {
                        Photo photoToDelete = ((PhotoIcon)controlSelected).PhotoObject;

                        if (MessageBox.Show(string.Concat("Czy na pewno chcesz usunąć zdjęcie \"", photoToDelete.vtitle, "\"?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            AlbumIcon selectedAlbumIco = GetSelectedAlbumIcon();
                            selectedAlbumIco.AlbumObject.DeletePhoto(photoToDelete);
                            LoadPhotos(selectedAlbumIco.AlbumObject);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public frmAlbumEdit(AlbumIcon albumToEdit, PhotoGallery parentPhotoGallery)
        {
            InitializeComponent();
            album = albumToEdit;

            this.txtTitle.Text = this.Text = album.Title;
            this.txtAuthor.Text = album.AlbumObject.vauthor;
            this.txtDescription.Text = album.AlbumObject.vdescribe;
            this.pbMainPhoto.Image = album.MainImage;

            parentGallery = parentPhotoGallery;
        }
Exemplo n.º 4
0
        public void DeleteSelectedAlbum()
        {
            AlbumIcon selectedAlbum = SelectedAlbum;

            if (selectedAlbum != null)
            {
                this.GalleryObjectSource.DeleteAlbum(selectedAlbum.AlbumObject);
                RefreshAlbumsView();
            }
            else
            {
                throw new NonSelectedAlbumException();
            }
        }
Exemplo n.º 5
0
        public void RefreshPhotosView()
        {
            AlbumIcon selectedAlbumIcon = GetSelectedAlbumIcon();

            if (selectedAlbumIcon != null)
            {
                LoadPhotos(selectedAlbumIcon.AlbumObject);
            }
            else
            {
                LoadPhotos(null);
            }

            this.panelPhotos.Refresh();
        }
Exemplo n.º 6
0
        public AlbumIcon GetSelectedAlbumIcon()
        {
            AlbumIcon ico = null;

            foreach (Control ctrl in this.panelAlbums.Controls)
            {
                if (ctrl is AlbumIcon)
                {
                    if (((AlbumIcon)ctrl).Selected == true)
                    {
                        ico = (AlbumIcon)ctrl;
                        return(ico);
                    }
                }
            }
            return(ico);
        }
Exemplo n.º 7
0
        public void RefreshAlbumsView()
        {
            foreach (Control ctrl in this.panelAlbums.Controls)
            {
                if (ctrl is AlbumIcon)
                {
                    this.panelAlbums.Controls.Remove(ctrl);
                }
            }

            this.panelAlbums.AutoScrollPosition = new Point(0, 0);

            if (this.GalleryObjectSource != null)
            {
                this.GalleryObjectSource.Albums = DbService.GetAll <Album>().ToList <Album>();

                if (this.GalleryObjectSource.Albums != null)
                {
                    int nextLocation = topMargin;

                    foreach (Album alb in this.GalleryObjectSource.Albums)
                    {
                        AlbumIcon albico = new AlbumIcon();
                        albico.Size             = new Size(widthAlbumObject, heightAlbumObject);
                        albico.Location         = new Point(leftMargin, nextLocation);
                        albico.Visible          = true;
                        albico.AlbumClick      += new AlbumIcon.AlbumIconClick(AlbumIcon_Click);
                        albico.ContextMenuStrip = this.cmAlbum;
                        albico.AlbumObject      = alb;

                        this.panelAlbums.Controls.Add(albico);

                        nextLocation += heightAlbumObject + topMargin * 2;
                    }
                }
            }

            this.panelAlbums.Refresh();
        }
Exemplo n.º 8
0
        public void RefreshAlbumsView()
        {
            foreach (Control ctrl in this.panelAlbums.Controls)
            {
                if (ctrl is AlbumIcon)
                {
                    this.panelAlbums.Controls.Remove(ctrl);
                }
            }

            this.panelAlbums.AutoScrollPosition = new Point(0, 0);

            if (this.GalleryObjectSource != null)
            {
                this.GalleryObjectSource.Albums = DbService.GetAll<Album>().ToList<Album>();

                if (this.GalleryObjectSource.Albums != null)
                {
                    int nextLocation = topMargin;

                    foreach (Album alb in this.GalleryObjectSource.Albums)
                    {
                        AlbumIcon albico = new AlbumIcon();
                        albico.Size = new Size(widthAlbumObject, heightAlbumObject);
                        albico.Location = new Point(leftMargin, nextLocation);
                        albico.Visible = true;
                        albico.AlbumClick += new AlbumIcon.AlbumIconClick(AlbumIcon_Click);
                        albico.ContextMenuStrip = this.cmAlbum;
                        albico.AlbumObject = alb;

                        this.panelAlbums.Controls.Add(albico);

                        nextLocation += heightAlbumObject + topMargin * 2;
                    }
                }
            }

            this.panelAlbums.Refresh();
        }
Exemplo n.º 9
0
        private void RefreshAlbumsView()
        {
            foreach (Control ctrl in this.panelAlbums.Controls)
            {
                if (ctrl is AlbumIcon)
                {
                    this.panelAlbums.Controls.Remove(ctrl);
                }
            }

            if (this.GalleryObjectSource != null)
            {
                if (this.GalleryObjectSource.Albums != null)
                {
                    int nextLocation = topMargin;

                    foreach (Album alb in this.GalleryObjectSource.Albums)
                    {
                        AlbumIcon albico = new AlbumIcon();
                        albico.Size = new Size(widthAlbumObject, heightAlbumObject);
                        albico.Location = new Point(leftMargin, nextLocation);
                        albico.Visible = true;
                        albico.AlbumClick += new AlbumIcon.AlbumIconClick(AlbumIcon_Click);
                        albico.AlbumObject = alb;

                        this.panelAlbums.Controls.Add(albico);

                        nextLocation += heightAlbumObject + topMargin;
                    }
                }
            }
        }