/// <summary>
 /// Method for removing playlist and notyfing background
 /// music player about made changes
 /// </summary>
 /// <param name="playlist"></param>
 public void RemovePlaylist(MusicPlaylistViewModel playlist)
 {
     if (playlist != null)
     {
         MusicPlaylists.Remove(playlist);
         App.SendMessageToBackground(MessageType.RemovePlaylist, playlist.Name);
         MainPage.Instance.Refresh();
     }
 }
 /// <summary>
 /// Method which adds given playlist to playlists list;
 /// Used mainly for initialization
 /// </summary>
 /// <param name="playlist">Playlist to add</param>
 public void AddPlaylist(MusicPlaylistViewModel playlist)
 {
     if (!MusicPlaylists.Exists(m => m.Name == playlist.Name))
     {
         MusicPlaylists.Add(playlist);
         App.SendPlaylistDataToBackground(playlist);
     }
     MainPage.Instance.SetPlaylists(MusicPlaylists);
 }
        /// <summary>
        /// Method which creates new playlist with given name and
        /// notyfies background about new playlist
        /// </summary>
        /// <param name="playlistName">Playlist name</param>
        /// <returns>True if playlist was succesfully created</returns>
        public bool CreatePlaylist(string playlistName)
        {
            bool ifSuccess = false;

            if (!MusicPlaylists.Exists(m => m.Name.ToLower() == playlistName.ToLower()))
            {
                ifSuccess = true;
                MusicPlaylists.Add(new MusicPlaylistViewModel(playlistName));
                App.SendMessageToBackground(MessageType.NewPlaylist, playlistName);
                MainPage.Instance.Refresh();
            }
            return(ifSuccess);
        }
 /// <summary>
 /// Method which removes all playlists and notyfies background
 /// player about made changes
 /// </summary>
 public void RemoveAllPlaylists()
 {
     MusicPlaylists.Clear();
     App.SendMessageToBackground(MessageType.RemovePlaylist, 0.ToString());
     MainPage.Instance.Refresh();
 }