public void GetNetMusicList(string searchStr, int offset, NetMusicType netMusicType)
        {
            int count = 0;

            Dispatcher.Invoke(new Action(() =>
            {
                LodingImage.Visibility = Visibility.Visible;
                if (offset == 0)
                {
                    CountLabel.DataContext = $"搜索\"{searchStr}\"";
                }
            }));
            var t = NetMusicHelper.GetNetMusicList(searchStr, offset, netMusicType, out count);

            Dispatcher.Invoke(new Action(() =>
            {
                ParentWindow.NetMusicList.Clear();
            }));
            foreach (var item in t)
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    ParentWindow.NetMusicList.Add(item);
                }));
            }
            Dispatcher.Invoke(new Action(() =>
            {
                if (offset == 0)
                {
                    CountLabel.DataContext = $"搜索\"{searchStr}\", 找到 {count} 首单曲";
                }
                if (offset == 0 && count <= 30)
                {
                    LastPageButton.IsEnabled = false;
                    NextPageButton.IsEnabled = false;
                }
                else if (offset == 0)
                {
                    LastPageButton.IsEnabled = false;
                    NextPageButton.IsEnabled = true;
                }
                else if (offset / 30 + 1 == count / 30 + (count % 30 == 0 ? 0 : 1))
                {
                    LastPageButton.IsEnabled = true;
                    NextPageButton.IsEnabled = false;
                }
                else
                {
                    LastPageButton.IsEnabled = true;
                    NextPageButton.IsEnabled = true;
                }
                MusicCount             = count;
                LodingImage.Visibility = Visibility.Hidden;
            }));
        }
Exemplo n.º 2
0
 private void XiaMiMusicButton_Click(object sender, RoutedEventArgs e)
 {
     CloudMusicButton.Visibility       = Visibility.Visible;
     QQMusicButton.Visibility          = Visibility.Visible;
     XiaMiMusicButton.Visibility       = Visibility.Hidden;
     CloudMusicButtonHelper.Visibility = Visibility.Hidden;
     QQMusicButtonHelper.Visibility    = Visibility.Hidden;
     XiaMiMusicButtonHelper.Visibility = Visibility.Visible;
     PageType = NetMusicType.XiaMiMusic;
     StartGetMusicListThread();
 }
Exemplo n.º 3
0
        private void GetPlayList(int offset, NetMusicType pageType)
        {
            if (!(ParentWindow?.IsConnectInternet() ?? false))
            {
                return;
            }
            int count = 0;

            Dispatcher.Invoke(new Action(() =>
            {
                LodingImage.Visibility = Visibility.Visible;
            }));
            var       list = NetMusicHelper.GetPlayList(Offset, PageType, out count);
            DataTable pic  = new DataTable();

            pic.Columns.Add("Name");
            pic.Columns.Add("ImgUrl");
            pic.Columns.Add("Url");
            foreach (var item in list)
            {
                pic.Rows.Add(item.Name, item.ImgUrl, item.Url);
            }
            Dispatcher.Invoke(new Action(() =>
            {
                if (count <= 1)
                {
                    LastPageButton.IsEnabled = false;
                    NextPageButton.IsEnabled = false;
                }
                else if (offset == 0)
                {
                    LastPageButton.IsEnabled = false;
                    NextPageButton.IsEnabled = true;
                }
                else if (offset == count)
                {
                    LastPageButton.IsEnabled = true;
                    NextPageButton.IsEnabled = false;
                }
                else
                {
                    LastPageButton.IsEnabled = true;
                    NextPageButton.IsEnabled = true;
                }
                SearchPageCount             = count;
                PlayListDisplay.ItemsSource = pic.DefaultView;
                LodingImage.Visibility      = Visibility.Hidden;
            }));
        }
Exemplo n.º 4
0
 private void XiaMiMusicButton_Click(object sender, RoutedEventArgs e)
 {
     if (CloseDataGridButton.Visibility == Visibility.Visible)
     {
         CloseDataGridButton_Click(new object(), e);
     }
     CloudMusicButton.Visibility       = Visibility.Visible;
     QQMusicButton.Visibility          = Visibility.Visible;
     XiaMiMusicButton.Visibility       = Visibility.Hidden;
     CloudMusicButtonHelper.Visibility = Visibility.Hidden;
     QQMusicButtonHelper.Visibility    = Visibility.Hidden;
     XiaMiMusicButtonHelper.Visibility = Visibility.Visible;
     PageType = NetMusicType.XiaMiMusic;
     Offset   = 0; SearchPageCount = 0;
     StartGetPlayListThread();
 }
Exemplo n.º 5
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;
            }));
        }
Exemplo n.º 6
0
        public void GetNetMusicList(string searchStr, int offset, NetMusicType netMusicType)
        {
            int count = 0;

            Dispatcher.Invoke(new Action(() =>
            {
                LodingImage.Visibility = Visibility.Visible;
                CountLabel.DataContext = $"搜索\"{searchStr}\"";
            }));
            var t = NetMusicHelper.GetNetMusicList(searchStr, offset, netMusicType, out count);

            Dispatcher.Invoke(new Action(() =>
            {
                MusicList.Clear();
                MusicList = t;
                NetMusicDataGrid.DataContext = MusicList;
            }));
            Dispatcher.Invoke(new Action(() =>
            {
                CountLabel.DataContext = $"搜索\"{searchStr}\", 找到 {count} 首单曲";
                LodingImage.Visibility = Visibility.Hidden;
            }));
        }
Exemplo n.º 7
0
        public void GetNetMusicList(RankingListType listType, NetMusicType netMusicType)
        {
            Dispatcher.Invoke(new Action(() =>
            {
                LodingImage.Visibility = Visibility.Visible;
            }));
            var t = NetMusicHelper.GetNetMusicList(listType, netMusicType);

            Dispatcher.Invoke(new Action(() =>
            {
                NetMusicList.Clear();
            }));
            foreach (var item in t)
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    NetMusicList.Add(item);
                }));
            }
            Dispatcher.Invoke(new Action(() =>
            {
                LodingImage.Visibility = Visibility.Hidden;
            }));
        }