Exemple #1
0
        public async void ShowLlink(string Id)
        {
            SearchSongResultById dsr = await BaiduMusicOp.GetMusicUrl(Id);

            this.Dispatcher.Invoke(new Action(() =>
            {
                qs = new QualitySelect(dsr);
                qs.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                qs.ShowDialog();
            }));
        }
Exemple #2
0
        private async void startAsyncSearch(int pageNum)
        {
            nvpb.Dispatcher.Invoke(new Action(() => { nvpb.Visibility = Visibility.Visible; }));
            SearchSongResultByKey bsr = await BaiduMusicOp.SearchMusicByKey(searchStr, pageNum);

            if (bsr == null || bsr.Song_List == null)
            {
                Tip.Dispatcher.Invoke(new Action(() => { Tip.Visibility = Visibility.Visible; }));
                return;
            }
            Songs = bsr.Song_List;
            this.Dispatcher.Invoke(new Action(() =>
            {
                totalPage           = bsr.Pages.Total / 10;
                this.dd.ItemsSource = Songs;
            }));
        }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            RadioButton rb = FindCellControl <RadioButton>("showSelected");

            if (rb == null)
            {
                return;
            }
            string fileLink = rb.Tag.ToString();

            if (fileLink == string.Empty)
            {
                return;
            }
            string file_Ext = "mp3";

            if (fileLink.Length < 5)
            {
                file_Ext = fileLink;
                List <HightQualitySongInfo> li = await BaiduMusicOp.GetLosslessMusicUrl(SongInfo.song_id, fileLink);

                fileLink = li[0].SongLink;
            }
            if (Common.downloadPage == null || !Common.downloadPage.IsLoaded)
            {
                Common.downloadPage = new DownloadPage();
            }
            Downloader download = DownloadManager.Instance.Add(
                new ResourceLocation {
                URL = fileLink, Password = SongInfo.album_title
            },
                null,
                MainWindow.DownloadFolder + SongInfo.author + "-" + SongInfo.title + "." + file_Ext,
                2,
                false);

            Console.WriteLine(MainWindow.DownloadFolder + SongInfo.author + "-" + SongInfo.title + "." + file_Ext);
            Common.downloadPage.Show();
            this.Close();
        }