Esempio n. 1
0
        private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                return;
            }

            IDatabaseDriver database = context.DatabaseDriver;
            DataGridViewRow row      = dataGridView1.SelectedRows[0];
            AlbumListEntry  entry    = (AlbumListEntry)row.DataBoundItem;

            if (entry == null)
            {
                return;
            }

            if (lastRowSelected == entry.id)
            {
                return;
            }
            lastRowSelected = entry.id;

            pictureBox1.BackgroundImage = database.Vgmdb_GetAlbumCover(entry.id);

            /*
             *  [x] postgres.public.dump_vgmdb_album_arbituaryproducts
             *  [x] postgres.public.dump_vgmdb_album_artist_arbitrary
             *  [x] postgres.public.dump_vgmdb_album_artist_type
             *  [x] postgres.public.dump_vgmdb_album_artists
             *  [x] postgres.public.dump_vgmdb_album_classification
             *  [x] postgres.public.dump_vgmdb_album_cover
             *  [x] postgres.public.dump_vgmdb_album_disc_track_translation
             *  [x] postgres.public.dump_vgmdb_album_disc_tracks
             *  [x] postgres.public.dump_vgmdb_album_discs
             *  [x] postgres.public.dump_vgmdb_album_label_arbiturary
             *  [x] postgres.public.dump_vgmdb_album_label_roles
             *  [x] postgres.public.dump_vgmdb_album_labels
             *  [x] postgres.public.dump_vgmdb_album_mediaformat
             *  [x] postgres.public.dump_vgmdb_album_relatedalbum
             *  [x] postgres.public.dump_vgmdb_album_releaseevent
             *  [x] postgres.public.dump_vgmdb_album_reprints
             *  [x] postgres.public.dump_vgmdb_album_titles
             *  [x] postgres.public.dump_vgmdb_album_types
             *  [x] postgres.public.dump_vgmdb_album_websites
             *  [ ] postgres.public.dump_vgmdb_albums
             */
            Album model = new Album();

            model.Products       = database.Vgmdb_FindProductNamesByAlbumId(entry.id).ToArray();
            model.Artists        = database.Vgmdb_FindArtistNamesByAlbumId(entry.id).ToArray();
            model.Classification = entry.classificationName;
            model.RelatedAlbums  = database.Vgmdb_FindRelatedAlbums(entry.id).ToArray();
            model.ReleaseEvent   = database.Vgmdb_GetReleaseEvent(entry.id);
            model.Reprints       = database.Vgmdb_FindReprints(entry.id).ToArray();
            model.TypeName       = entry.typeName;
            model.Websites       = database.Vgmdb_GetWebsites(entry.id).ToArray();
            if (entry.date.HasValue)
            {
                model.Date = entry.date.Value.ToShortDateString();
            }
            else
            {
                model.Date = "???";
            }
            model.Publisher = entry.publisher;

            Galleria.DefaultGalleriaModel galleriaModel = new Galleria.DefaultGalleriaModel();
            galleria1.GalleriaModel = galleriaModel;
            galleriaModel.AddRange(database.FindCoversByAlbumId(entry.id));
            galleria1.GalleriaModel = galleriaModel;
            galleria1.Visible       = galleriaModel.Count > 0;

            Tuple <string, int, int, string, int>[] trackTuples = database.Vgmdb_FindTrackDataByAlbum(entry.id).ToArray();
            model.Tracks = Array.ConvertAll(trackTuples, x => new Track(x));

            model.Labels      = database.Vgmdb_FindLabelNamesByAlbumId(entry.id).ToArray();
            model.MediaFormat = entry.mediaformatName;

            notesTextBox.Text = entry.notes;

            propertyGrid1.SelectedObject = model;
        }