Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Album"/> class.
 /// </summary>
 /// <param name="repository">The album repository.</param>
 /// <param name="albumId">The album id.</param>
 /// <param name="photos">The photos.</param>
 /// <remarks>
 ///   <para>Authors: Jim Counts and Eric Wei</para>
 ///   <para>Created: 2011-10-28</para>
 /// </remarks>
 public Album(AlbumRepository repository, string albumId, IEnumerable<IPhoto> photos)
 {
     this.Repository = repository;
     this.AlbumId = albumId;
     foreach (var photo in photos)
     {
         this.photos.Add(photo.PhotoId, photo);
     }
 }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SearchResultAlbum"/> class.
        /// </summary>
        /// <param name="albumRepository">The album repository.</param>
        /// <param name="albumId">The album id.</param>
        /// <param name="photos">The photos.</param>
        /// <remarks>
        ///   <para>Authors: Jim Counts and Eric Wei.</para>
        ///   <para>Created: 2011-11-03</para>
        /// </remarks>
        public SearchResultAlbum(AlbumRepository albumRepository, string albumId, IEnumerable<IPhoto> photos)
        {
            this.AlbumId = albumId;
            this.albumRepository = albumRepository;

            foreach (var photo in photos)
            {
                this.photoBucket.Add(photo);
            }
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HomeScreenUserControl"/> class.
        /// </summary>
        /// <param name="albumRepository">The collection of albums.</param>
        /// <remarks>
        ///   <para>Author(s): Miguel Gonzales, Andrea Tan, Jim Counts and Eric Wei</para>
        ///   <para>Modified: 2011-28-10</para>
        /// </remarks>
        public HomeScreenUserControl(AlbumRepository albumRepository)
        {
            if (albumRepository == null)
            {
                throw new ArgumentNullException("albumRepository", "albumRespository is null.");
            }

            this.InitializeComponent();
            this.albums = albumRepository;
            this.Dock = DockStyle.Fill;
            this.DisplayName = "Albums";
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateAlbumUserControl"/> class.
        /// </summary>
        /// <param name="albumRepository">The album repository.</param>
        /// <remarks>
        /// Author(s): Miguel Gonzales and Andrea Tan
        /// </remarks>
        public CreateAlbumUserControl(AlbumRepository albumRepository)
        {
            this.InitializeComponent();

            this.Model = albumRepository;
            this.Dock = DockStyle.Fill;
            this.DisplayName = "Create New Album";
            this.createHeaderLabel.Text = this.DisplayName;

            // Default to creating a new album.
            this.CreateAlbumLabel.Text = "Please enter the name of the new album:";
            this.albumNameTextBox.Text = string.Empty;
            this.createHeaderLabel.Text = this.DisplayName;
            this.albumNameTextBox.Focus();
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlAlbum"/> class.
        /// </summary>
        /// <param name="albumRepository">The album repository.</param>
        /// <param name="albumElement">The album element.</param>
        /// <remarks>
        ///   <para>Author: Jim Counts and Eric Wei</para>
        ///   <para>Created: 2011-11-03</para>
        /// </remarks>
        public XmlAlbum(AlbumRepository albumRepository, XElement albumElement)
        {
            this.albumElement = albumElement;
            string albumId = this.albumElement.Attribute(IdTag).Value;

            IEnumerable<IPhoto> photos = from photoElement in this.albumElement.Descendants(PhotoTag)
                                         select new XmlPhoto(this, photoElement);
            this.decoratedAlbum = new Album(albumRepository, albumId, photos);
            var attribute = this.albumElement.Attribute(CoverTag);
            if (attribute != null)
            {
                var coverPhoto = this.decoratedAlbum.GetPhoto(attribute.Value);
                this.decoratedAlbum.CoverPhoto = coverPhoto;
            }
        }