Example #1
0
        private void listBoxTaggetFriends_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.AlbumsTaggetUsers.SelectedItems.Count == 1)
            {
                string taggetFriendName = this.AlbumsTaggetUsers.SelectedItem.ToString();
                AlbumsPhotosPanel.Controls.Clear();
                IAggregate albumPhotosAggregate = new AlbumPhotosAggregate(this.m_Album);
                IIterator albumPhotosIterator = albumPhotosAggregate.CreateIterator();

                if (!albumPhotosIterator.IsDone)
                {
                    this.AlbumPictureBox.LoadAsync((albumPhotosIterator.CurrentItem as Photo).URL);

                    foreach (Photo photo in albumPhotosIterator.NextItem)
                    {
                        if (photo.Tags != null && photo.Tags.Count > 0)
                        {
                            foreach (PhotoTag tagg in photo.Tags)
                            {
                                if (tagg.User.Name == taggetFriendName)
                                {
                                    AlbumsPhotosControler thumbnail = new AlbumsPhotosControler(photo.URL, this.AlbumsPhotosPanel.Controls.Count);
                                    thumbnail.PictureBox.Click += new EventHandler(this.thumbnail_Click);
                                    this.AlbumsPhotosPanel.Controls.Add(thumbnail);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Display selected album photos
        /// </summary>
        private void displaySelectedAlbumsPhotosThread(IIterator i_AlbumPhotosIterator)
        {
            if (!i_AlbumPhotosIterator.IsDone)
            {
                Thread threadLoadAlbumPicture = new Thread(new ThreadStart(
                    () => this.AlbumPictureBox.LoadAsync((i_AlbumPhotosIterator.CurrentItem as Photo).URL)));
                threadLoadAlbumPicture.Start();

                foreach (Photo photo in i_AlbumPhotosIterator.NextItem)
                {
                    AlbumsPhotosControler thumbnail = new AlbumsPhotosControler(photo.URL, AlbumsPhotosPanel.Controls.Count);
                    thumbnail.PictureBox.Click += new EventHandler(this.thumbnail_Click);
                    lock (s_LockObj)
                    {
                        this.AlbumsPhotosPanel.Invoke(new Action(() => AlbumsPhotosPanel.Controls.Add(thumbnail)));
                    }
                }
            }
        }