Exemplo n.º 1
0
        /// <summary>
        /// Refresh 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnArtRefresh_Click(object sender, EventArgs e)
        {
            DBBasicInfo mv = null;
              switch (tcMusicVideo.SelectedTab.Name)
              {
            case "tpArtist":
              mv = CurrentArtist;
              break;
            case "tpAlbum":
              mv = CurrentAlbum;
              break;
            case "tpTrack":
              mv = CurrentTrack;
              break;
              }
              if (mv == null) return;

              List<DBSourceInfo> r1 = new List<DBSourceInfo>();
              foreach (DBSourceInfo r2 in mvCentralCore.DataProviderManager.AllSources)
              {
            var flag = false;
            if (mv.GetType() == typeof(DBArtistInfo))
              flag = r2.Provider.ProvidesArtistArt;
            if (mv.GetType() == typeof(DBAlbumInfo))
              flag = r2.Provider.ProvidesAlbumArt;
            if (mv.GetType() == typeof(DBTrackInfo))
              flag = r2.Provider.ProvidesTrackArt;

            if (flag)
            {
              r1.Add(r2);
            }
              }

              SourcePopup sp = new SourcePopup(r1);
              if (sp.ShowDialog() == DialogResult.OK)
              {
            mv.PrimarySource = r1[sp.listBox1.SelectedIndex];
              }

              // the update process can take a little time, so spawn it off in another thread
              ThreadStart actions = delegate
              {
            startArtProgressBar();
            mvCentralCore.DataProviderManager.GetArt(mv, true);
            stopArtProgressBar();
              };
              Thread thread = new Thread(actions);
              thread.Name = "ArtUpdater";
              thread.Start();
        }
Exemplo n.º 2
0
        private void tsmGetInfo_Click(object sender, EventArgs e)
        {
            DBBasicInfo mv = null;
              switch (tcMusicVideo.SelectedTab.Name)
              {
            case "tpArtist":
              mv = CurrentArtist;
              break;
            case "tpAlbum":
              mv = CurrentAlbum;
              break;
            case "tpTrack":
              mv = CurrentTrack;
              break;
              }
              if (mv == null) return;

              var r1 = new List<DBSourceInfo>();
              foreach (DBSourceInfo r2 in mvCentralCore.DataProviderManager.AllSources)
              {
            var flag = false;
            if (mv.GetType() == typeof(DBArtistInfo))
              flag = r2.Provider.ProvidesArtistDetails;
            if (mv.GetType() == typeof(DBAlbumInfo))
              flag = r2.Provider.ProvidesAlbumDetails;
            if (mv.GetType() == typeof(DBTrackInfo))
              flag = r2.Provider.ProvidesTrackDetails;

            if (flag)
            {
              r1.Add(r2);
            }
              }

              var sp = new SourcePopup(r1);
              if (sp.ShowDialog() != DialogResult.OK) return;

              mv.PrimarySource = r1[sp.listBox1.SelectedIndex];
              // the update process can take a little time, so spawn it off in another thread
              ThreadStart actions = delegate
            {
              startArtProgressBar();
              mv.PrimarySource.Provider.ProgressChanged += (s, args) => updateProgressBar(((ProgressEventArgs)args).Text);
              mv.PrimarySource.Provider.GetDetails(mv);
              mv.Commit();
              stopArtProgressBar();
            };

              var thread = new Thread(actions);
              thread.Name = "DetailsUpdater";
              thread.Start();
        }