private void mn_pop_btn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            url = "http://115.71.236.224:8081/getBillboardChart";

            musicCollection.Clear();
            MsgBroker.MsgBrokerMsg arg = new MsgBroker.MsgBrokerMsg();
            arg.MsgOPCode = UI_CONTROL.PROGRESS_SHOW;
            Orange.Util.UI_Flag.IsChart = true;
            (Application.Current as App).msgBroker.SendMessage(arg);
            Thread thread = new Thread(new ThreadStart(ParsingThread));

            thread.Start();
        }
Exemple #2
0
        private async void AllMusic_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                MusicCollection.AddRange(e.NewItems.Cast <LocalMusic>());
                // ArtistCollection.AddRange(e.NewItems.Cast<LocalMusic>());
                AlbumCollection.AddRange(e.NewItems.Cast <LocalMusic>());
                break;

            case NotifyCollectionChangedAction.Remove:
                foreach (LocalMusic item in e.OldItems)
                {
                    MusicCollection.Remove(item);
                    //  ArtistCollection.Remove(item);
                    AlbumCollection.Remove(item);
                }
                await ArtistCollection.AddRangeAsync(AllMusic.GroupBy(x => x.ArtistsName?.FirstOrDefault() ?? "未知艺术家").ToDictionary(x => x.Key, x => x.ToArray())
                                                     .Select(x =>
                                                             new LocalArtist
                {
                    Name        = x.Key,
                    PicPath     = x.Value.First().Id3Pic,
                    LocalMusics = x.Value
                }));

                break;

            case NotifyCollectionChangedAction.Replace:
                break;

            case NotifyCollectionChangedAction.Move:
                break;

            case NotifyCollectionChangedAction.Reset:
                MusicCollection.Clear();
                ArtistCollection.Clear();
                AlbumCollection.Clear();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }