public static MenuFlyout GetPlaylistMenu(PlaylistVk playlist) { var menu = new MenuFlyout(); menu.Items?.Add(new MenuFlyoutItem() { Text = Resources.GetStringByKey("ContextMenu_Play"), Command = ViewModelLocator.Main.PlayPlaylistCommand, CommandParameter = playlist }); if (playlist.IsAddedByCurrentUser) { if (playlist.IsEditable) { menu.Items?.Add(new MenuFlyoutItem() { Text = Resources.GetStringByKey("ContextMenu_Edit"), Command = ViewModelLocator.Main.EditPlaylistCommand, CommandParameter = playlist }); } menu.Items?.Add(new MenuFlyoutItem() { Text = Resources.GetStringByKey("ContextMenu_Remove"), Command = ViewModelLocator.Main.DeletePlaylistCommand, CommandParameter = playlist }); } else { menu.Items?.Add(new MenuFlyoutItem() { Text = Resources.GetStringByKey("ContextMenu_FollowPlaylist"), Command = ViewModelLocator.Main.SavePlaylistCommand, CommandParameter = playlist }); } return(menu); }
public async Task <bool> DeletePlaylist(PlaylistVk playlist) { try { return(await _vk.Audio.DeletePlaylist(ownerId : long.Parse(playlist.OwnerId), playlistId : long.Parse(playlist.Id))); } catch (VkInvalidTokenException) { Messenger.Default.Send(new MessageUserAuthChanged { IsLoggedIn = false }); } return(false); }
public async Task <bool> FollowPlaylist(PlaylistVk playlist) { try { var response = await _vk.Audio.FollowPlaylist(ownerId : long.Parse(playlist.OwnerId), playlistId : long.Parse(playlist.Id), accessKey : playlist.AccessKey); return(response != 0); } catch (VkInvalidTokenException) { Messenger.Default.Send(new MessageUserAuthChanged { IsLoggedIn = false }); } return(false); }
public override void OnNavigatedTo(Dictionary <string, object> parameters, NavigationMode mode) { if (parameters == null) { Playlist = new PlaylistVk() { Title = Resources.GetStringByKey("EditPlaylist_NewPlaylistTitle") } } ; else { Playlist = (PlaylistVk)parameters["playlist"]; } Title = Playlist.Title; base.OnNavigatedTo(parameters, mode); }
/// <summary> /// Edit playlist /// </summary> /// <returns>True if success, otherwise false</returns> public async Task <bool> EditPlaylist(PlaylistVk playlist, string title) { return(await _vk.Audio.EditAlbum(playlist.Id, title)); }