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"; } }); }); }
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; }); }); }
public async Task <List <Song> > FetchSongsFromPlayList(PlayList playList) { PlayListServiceClient = new YoutubePlayListServiceClient(); return(await PlayListServiceClient.FetchSongsFromPlayList(playList)); }
public async Task <List <PlayList> > FetchMyPlayLists() { PlayListServiceClient = new YoutubePlayListServiceClient(); return(await PlayListServiceClient.MyPlayLists()); }