Exemplo n.º 1
0
        public SongDetailViewModel(Song item = null)
        {
            Title     = item?.Title;
            Item      = item;
            PlayLists = new ObservableCollection <PlayList>();

            MessagingCenter.Subscribe <SongDetailPage>(this, "AddSongToPlayList", async(obj) =>
            {
                await ExecuteAsyncCode(async() =>
                {
                    if (Validated())
                    {
                        PlayListServiceClient = new YoutubePlayListServiceClient();
                        await PlayListServiceClient.AddSongToPlayList(SelectedPlayList, Item);
                        Status      = "Song added to playlist";
                        HasStatus   = true;
                        StatusColor = "Green";
                    }
                });
            });
        }
Exemplo n.º 2
0
 public NewPlayListViewModel()
 {
     Title = "New Play List";
     MessagingCenter.Subscribe <NewPlayListPage>(this, "CreatePlayList", async(obj) =>
     {
         await ExecuteAsyncCode(async() =>
         {
             if (!string.IsNullOrWhiteSpace(PlayListTitle))
             {
                 PlayListServiceClient = new YoutubePlayListServiceClient();
                 await PlayListServiceClient.CreatePlayList(PlayListTitle, PlayListDescription);
                 Status      = "Playlist created successfully";
                 StatusColor = "Green";
             }
             else
             {
                 Status      = "Title is required!";
                 StatusColor = "Red";
             }
             HasStatus = true;
         });
     });
 }
Exemplo n.º 3
0
 public async Task <List <Song> > FetchSongsFromPlayList(PlayList playList)
 {
     PlayListServiceClient = new YoutubePlayListServiceClient();
     return(await PlayListServiceClient.FetchSongsFromPlayList(playList));
 }
Exemplo n.º 4
0
 public async Task <List <PlayList> > FetchMyPlayLists()
 {
     PlayListServiceClient = new YoutubePlayListServiceClient();
     return(await PlayListServiceClient.MyPlayLists());
 }