Beispiel #1
0
        private void GetPlayListItems(string url, NetMusicType pageType)
        {
            Dispatcher.Invoke(new Action(() =>
            {
                LodingImage.Visibility = Visibility.Visible;
            }));
            var list = NetMusicHelper.GetPlayListItems(url, PageType);

            Dispatcher.Invoke(new Action(() =>
            {
                ButtonGroup.Visibility               = Visibility.Hidden;
                LodingImage.Visibility               = Visibility.Hidden;
                NetMusicDataGrid.DataContext         = list;
                NetMusicDataGrid.Visibility          = Visibility.Visible;
                PlayAllLocalButton.Visibility        = Visibility.Visible;
                AllAddToCurrentListButton.Visibility = Visibility.Visible;
                AddToMyPlayListButton.Visibility     = Visibility.Visible;
                PlayListDisplay.Visibility           = Visibility.Hidden;
                LastPageButton.Visibility            = Visibility.Hidden;
                NextPageButton.Visibility            = Visibility.Hidden;
                CloseDataGridButton.Visibility       = Visibility.Visible;
            }));
        }
        private void AddNewPlayList(string url)
        {
            string       name = string.Empty, imgurl = string.Empty;
            NetMusicType type;

            if (url.Contains("music.163.com"))
            {
                type = NetMusicType.CloudMusic;
            }
            else if (url.Contains("y.qq.com"))
            {
                type = NetMusicType.QQMusic;
            }
            else if (url.Contains("xiami.com"))
            {
                type = NetMusicType.XiaMiMusic;
            }
            else
            {
                return;
            }
            var nlist = NetMusicHelper.GetPlayListItems(url, type, out name, out imgurl);
            ObservableCollection <Music> mlist = new ObservableCollection <Music>();

            foreach (var item in nlist)
            {
                mlist.Add(new Music(item));
            }
            if (mlist.Count > 0)
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    PlayListCollection.Add(new PlayListCollectionModel(name, imgurl, mlist));
                }));
            }
        }