コード例 #1
0
        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;
            }));
        }
コード例 #2
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;
            }));
        }
コード例 #3
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;
            }));
        }