Beispiel #1
0
 private async void DownloadItem_LoadedAsync(object sender, RoutedEventArgs e)
 {
     tb.Text = MData.MusicName + " - " + MData.SingerText;
     d       = new HttpDownloadHelper(MData.MusicID, path);
     Loadedd();
     d.ProgressChanged += (pro) =>
     {
         Dispatcher.Invoke(() =>
         {
             finished = true;
             Pb.Value = pro;
             zt.Text  = pro + "%";
         });
     };
     d.Finished += () =>
     {
         Dispatcher.Invoke(() =>
         {
             finished = true;
             zt.Text  = "已完成";
         });
     };
     d.GetSize += (s) =>
     {
         Dispatcher.Invoke(() =>
         {
             size.Text = s;
         });
     };
     if (index == 0 || index == 1 || index == 2)
     {
         d.Download();
     }
     await MusicLib.GetLyric(MData.MusicID, path.Replace(".mp3", ".lrc"));
 }
Beispiel #2
0
 private void Load()
 {
     tb.Text            = MData.MusicName + " - " + MData.SingerText;
     d                  = new HttpDownloadHelper(MData.MusicID, path);
     d.ProgressChanged += (pro) =>
     {
         Dispatcher.Invoke(() =>
         {
             Pb.Value = pro;
             zt.Text  = pro + "%";
         });
     };
     d.Finished += async() =>
     {
         if (Settings.USettings.DownloadWithLyric)
         {
             await MusicLib.GetLyric(MData.MusicID, path.Replace(".mp3", ".lrc"));
         }
         Dispatcher.Invoke(() =>
         {
             Finished(this);
             finished = true;
             zt.Text  = "已完成";
         });
     };
     d.GetSize += (s) =>
     {
         Dispatcher.Invoke(() =>
         {
             size.Text = s;
         });
     };
     if (index == 0)
     {
         d.Download();
     }
 }