示例#1
0
 public SongListInfoPage(ISongList songlist)
 {
     InitializeComponent();
     this.Dispatcher.BeginInvoke(new Action(() =>
     {
         (this.DataContext as SongListInfoPageViewModel).GetInfo(songlist);
     }));
 }
示例#2
0
 public PlatformInfoModel(ISongList songlist)
 {
     Id         = songlist.Id;
     Musics     = songlist.Musics;
     CoverUrl   = songlist.CoverUrl;
     Origin     = songlist.Origin;
     SourceName = songlist.SourceName;
     Title      = songlist.Title;
 }
        public async void ClickImportExecute()
        {
            //获取类型
            MusicSource source;

            if (ChooseKugou)
            {
                source = MusicSource.Kugou;
            }
            else if (ChooseNetease)
            {
                source = MusicSource.Netease;
            }
            else
            {
                source = MusicSource.Tencent;
            }

            ISongList songList = null;
            bool      isError  = false;
            await Task.Run(() =>
            {
                Thread.Sleep(300);
                ImportButtonVisibility  = Visibility.Hidden;
                LoadingButtonVisibility = Visibility.Visible;
                try
                {
                    songList = CoreApi.GetPlatformSongList(source, ImportUrl);
                }
                catch
                {
                    isError = true;
                }
                ImportButtonVisibility  = Visibility.Visible;
                LoadingButtonVisibility = Visibility.Hidden;
            });

            if (isError)
            {
                Toast.Show("导入失败!", Toast.InfoType.Error);
            }
            else
            {
                new PlatformInfoManager().Insert(new PlatformInfoModel(songList));
                foreach (var item in songList.Musics)
                {
                    new PlatformListManager().Insert(new PlatformListModel
                    {
                        MusicId    = item.Id,
                        PlatformId = songList.Id
                    });
                    new MusicInfoManager().Insert(new MusicInfoModel(item));
                }
                ViewModelManager.BasePageViewModel.RefreshPlatformList();
                Toast.Show("导入成功!", Toast.InfoType.Success);
            }
        }
示例#4
0
        public static List <SongDto> GetFollowingSongs(this ISongList songList, int count)
        {
            var list = new List <SongDto>
            {
                songList.CurrentSong
            };

            for (int i = 0; i < count - 1; i++)
            {
                list.Add(songList.MoveNext().CurrentSong);
            }

            return(list);
        }
示例#5
0
        public static bool CanEditSongList(IUserPermissionContext permissionContext, ISongList songList)
        {
            if (songList.FeaturedList && CanManageFeaturedLists(permissionContext))
            {
                return(true);
            }

            if (permissionContext.HasPermission(PermissionToken.EditAllSongLists))
            {
                return(true);
            }

            return(songList.Author.IsTheSameUser(permissionContext.LoggedUser));
        }
示例#6
0
        public async void GetInfo(ISongList songlist)
        {
            this.SongList = songlist;

            SongListInfoContent content = await ServiceProvider.GetService <ISongListService>().GedanInfoAsync(this.SongList.ListId);

            if (!content.HasError)
            {
                foreach (var song in content.Songs)
                {
                    this.Songs.Add(song);
                }

                this.PictureUrl = content.PictureS500;
            }
        }
示例#7
0
 public void PlaySongList(ISongList songlist)
 {
     throw new NotImplementedException();
 }
 public SongListPresenter(ISongList param)
 {
     view = param;
 }