Exemplo n.º 1
0
        public async void Init(string plid, string plname)
        {
            if (!string.IsNullOrEmpty(plid))
            {
                this.plid        = plid;
                this.currentItem = new SongListInitItem()
                {
                    ItemType = SongListEnum.CustomPl, Item = plid + ";;;" + plname
                };
                this.isPlaylist   = true;
                this.playlistName = plname;
                this.IsBusy       = true;
                this.PicUrl       = "http://fildo.net/splash.png";
                var tempSongs = await this.netEase.GetPlaylistSongs(plid);

                this.Songs = new ObservableCollection <ItemWrap>();
                if (tempSongs != null)
                {
                    foreach (var item in tempSongs)
                    {
                        this.Songs.Add(new ItemWrap(item, this));
                    }
                }
                else
                {
                    this.dialog.ShowAlert(Texts.ErrorGettingResults, 5000);
                }
                this.IsBusy = false;
                this.RaisePropertyChanged(() => this.TitleView);
            }
        }
Exemplo n.º 2
0
        public async void Init(Album album)
        {
            if (album.AlbumId != null)
            {
                this.currentItem = new SongListInitItem()
                {
                    ItemType = SongListEnum.Album, Item = album
                };
                this.isAlbum   = true;
                this.albumName = album.Name;
                this.PicUrl    = album.ImageUrl;
                this.IsBusy    = true;

                List <SongNetease> tempSong = new List <SongNetease>();
                tempSong = await this.netEase.GetSongsForAlbum(album.AlbumId, album.Artist);

                this.Songs = new ObservableCollection <ItemWrap>();
                if (tempSong == null)
                {
                    this.dialog.ShowAlert(Texts.ErrorGettingResults, 5000);
                }
                else
                {
                    foreach (var item in tempSong)
                    {
                        this.Songs.Add(new ItemWrap(item, this));
                    }
                }
                this.RaisePropertyChanged(() => this.Songs);
                this.IsBusy = false;
                this.RaisePropertyChanged(() => this.TitleView);
            }
        }
Exemplo n.º 3
0
        public async void Init(NetEasePlaylist netEasePlaylist)
        {
            if ((netEasePlaylist != null) && !string.IsNullOrEmpty(netEasePlaylist.Id) && netEasePlaylist.IsRealPl)
            {
                this.currentItem = new SongListInitItem()
                {
                    ItemType = SongListEnum.NeteasePl, Item = netEasePlaylist
                };
                this.isPlaylist   = true;
                this.playlistName = netEasePlaylist.Name;
                this.IsBusy       = true;
                this.PicUrl       = netEasePlaylist.PicUrl;
                var tempSongs = await this.netEase.GetNetEasePlaylistSongs(netEasePlaylist.Id);

                this.Songs = new ObservableCollection <ItemWrap>();
                if (tempSongs != null)
                {
                    foreach (var item in tempSongs)
                    {
                        this.Songs.Add(new ItemWrap(item, this));
                    }
                }
                else
                {
                    this.dialog.ShowAlert(Texts.ErrorGettingNeteasePL, 5000);
                }
                this.IsBusy = false;
                this.RaisePropertyChanged(() => this.TitleView);
            }
        }
Exemplo n.º 4
0
        public async void Init(AutocompleteSearch autocompleteSearch)
        {
            if (string.IsNullOrEmpty(autocompleteSearch.Id) || string.IsNullOrEmpty(autocompleteSearch.ResultType))
            {
                return;
            }

            this.IsBusy      = true;
            this.currentItem = new SongListInitItem()
            {
                ItemType = SongListEnum.AutoComplete, Item = autocompleteSearch
            };
            if (!string.IsNullOrEmpty(autocompleteSearch.PicUrl))
            {
                this.PicUrl = autocompleteSearch.PicUrl.Replace("Small", string.Empty);
            }
            if (autocompleteSearch.AutoCompleteType == AutoCompleteType.Xiami)
            {
                List <SongNetease> tempSong = new List <SongNetease>();
                tempSong = await this.netEase.GetXiamiSongs(autocompleteSearch);

                this.Songs = new ObservableCollection <ItemWrap>();

                if (tempSong == null)
                {
                    this.dialog.ShowAlert(Texts.ErrorGettingResults, 5000);
                }
                else
                {
                    foreach (var item in tempSong)
                    {
                        this.Songs.Add(new ItemWrap(item, this));
                    }
                }
            }
            else
            {
                //this.Songs = await this.netEase.Autocomplete(toSearch);
                List <SongNetease> tempSong = new List <SongNetease>();
                if (autocompleteSearch.ResultType == "Album")
                {
                    tempSong = await this.netEase.GetSongsForAlbum(autocompleteSearch.Id, autocompleteSearch.ArtistName);
                }
                else if (autocompleteSearch.ResultType == "Song")
                {
                    List <SongNetease> songs = new List <SongNetease>();
                    SongNetease        song  = await this.netEase.GetSong(autocompleteSearch.Id);

                    if (song != null)
                    {
                        tempSong.Add(song);
                    }
                    else
                    {
                        tempSong = null;
                    }
                }
                else if (autocompleteSearch.ResultType == "Artist")
                {
                    this.IsArtist = true;
                    tempSong      = await this.netEase.SearchArtist(autocompleteSearch.Id, autocompleteSearch.Name);

                    this.Albums = await this.netEase.SearchAlbums(autocompleteSearch.Id, autocompleteSearch.Name);

                    this.SimilarArtists = await this.netEase.GetSimilar(autocompleteSearch.Name);

                    if ((this.Albums == null) || (this.SimilarArtists == null))
                    {
                        this.dialog.ShowAlert(Texts.ErrorGettingResults, 5000);
                    }
                }
                this.Songs = new ObservableCollection <ItemWrap>();

                if (tempSong == null)
                {
                    this.dialog.ShowAlert(Texts.ErrorGettingResults, 5000);
                }
                else
                {
                    foreach (var item in tempSong)
                    {
                        this.Songs.Add(new ItemWrap(item, this));
                    }
                }
            }
            this.RaisePropertyChanged(() => this.Songs);
            this.IsBusy = false;
            this.RaisePropertyChanged(() => this.TitleView);
        }