Exemplo n.º 1
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (pictureBox1.BackgroundImage != null)
            {
                pictureBox1.BackgroundImage.Dispose();
                pictureBox1.BackgroundImage = null;
            }

            metadataTextbox.Text = "";

            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }

            VocaDbSearchResultListViewItem listViewItem = listView1.SelectedItems[0] as VocaDbSearchResultListViewItem;
            Image cover = context.DatabaseDriver.Vocadb_GetAlbumCover(listViewItem.wrapped.Id);

            if (cover != null)
            {
                pictureBox1.BackgroundImage       = cover;
                pictureBox1.BackgroundImageLayout = ImageLayout.Zoom;
            }

            IEnumerable <VocadbTrackEntry> tracks = context.DatabaseDriver.VocaDb_GetTracksByAlbum(listViewItem.wrapped.Id);
            StringWriter sw = new StringWriter();

            foreach (VocadbTrackEntry trackEntry in tracks)
            {
                sw.WriteLine("{0}.{1} {2}", trackEntry.DiscNumber, trackEntry.TrackNumber, trackEntry.Name);
            }

            metadataTextbox.Text = sw.ToString();
        }
Exemplo n.º 2
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            listView1.Items.Clear();

            List <string> searchStrings = context.DatabaseDriver.VocaDb_FindAlbumNamesBySongNames(toolStripTextBox1.Text);

            searchStrings.Add(toolStripTextBox1.Text);

            foreach (string word in searchStrings.Distinct())
            {
                IEnumerable <VocadbSearchResult> results = context.DatabaseDriver.VocaDb_Search(word);
                foreach (VocadbSearchResult searchResult in results)
                {
                    VocaDbSearchResultListViewItem item = new VocaDbSearchResultListViewItem(searchResult);
                    listView1.Items.Add(item);
                }
            }
        }