/// <summary>
        /// Retorna uma lista com as músicas de determinado álbum em ordem de número de faixa
        /// </summary>
        /// <param name="albumID">Código de identificação do álbum</param>
        /// <returns></returns>
        public static List <Song> GetSongsByAlbumID(string albumID)
        {
            List <Song> list = new List <Song>();
            Song        aux;

            if (IsCollectionLoaded)
            {
                XmlNodeList nodes = CollectionDocument.SelectNodes("/Collection/Song[@AlbumID=\"" + albumID + "\"]") as XmlNodeList;

                foreach (XmlElement element in nodes)
                {
                    aux = new Song();
                    aux.Set(element.GetAttribute("Title"),
                            element.GetAttribute("Artist"),
                            element.GetAttribute("Album"),
                            element.GetAttribute("AlbumID"),
                            element.GetAttribute("ID"),
                            element.GetAttribute("Year"),
                            element.GetAttribute("Track"),
                            element.GetAttribute("Genre"),
                            element.GetAttribute("Path"),
                            element.GetAttribute("HexColor"));
                    list.Add(aux);
                }
            }

            list = list.OrderBy(s => s.TrackNumber).ToList();

            return(list);
        }
        public static List <Song> GetSongs(bool sort)
        {
            string orderBy = "";

            if (ApplicationData.Current.LocalSettings.Values.ContainsKey("SongsSortBy"))
            {
                orderBy = ApplicationData.Current.LocalSettings.Values["SongsSortBy"].ToString();
            }
            else
            {
                orderBy = "Artist";
            }

            if (orderBy == "Song")
            {
                orderBy = "Title";
            }

            IEnumerable <IXmlNode> xmlList;
            List <Song>            list = new List <Song>();

            if (IsCollectionLoaded)
            {
                if (sort)
                {
                    xmlList = CollectionDocument.SelectNodes("/Collection/Song").OrderBy(node => ((XmlElement)node).GetAttribute(orderBy)) as IEnumerable <IXmlNode>;
                }
                else
                {
                    xmlList = CollectionDocument.SelectNodes("/Collection/Song") as IEnumerable <IXmlNode>;
                }

                foreach (XmlElement element in xmlList)
                {
                    Song aux = new Song();
                    if (element == null)
                    {
                        return(null);
                    }

                    aux.Set(element.GetAttribute("Title"),
                            element.GetAttribute("Artist"),
                            element.GetAttribute("Album"),
                            element.GetAttribute("AlbumID"),
                            element.GetAttribute("ID"),
                            element.GetAttribute("Year"),
                            element.GetAttribute("Track"),
                            element.GetAttribute("Genre"),
                            element.GetAttribute("Path"),
                            element.GetAttribute("HexColor"));
                    list.Add(aux);
                }

                return(list);
            }
            else
            {
                return(null);
            }
        }
        public static IEnumerable <IXmlNode> GetAllSongs(bool sort)
        {
            string orderBy = "";

            if (ApplicationData.Current.LocalSettings.Values.ContainsKey("SongsSortBy"))
            {
                orderBy = ApplicationData.Current.LocalSettings.Values["SongsSortBy"].ToString();
            }
            else
            {
                orderBy = "Artist";
            }

            if (orderBy == "Song")
            {
                orderBy = "Title";
            }

            if (IsCollectionLoaded)
            {
                if (sort)
                {
                    return(CollectionDocument.SelectNodes("/Collection/Song").OrderBy(node => ((XmlElement)node).GetAttribute(orderBy)) as IEnumerable <IXmlNode>);
                }
                else
                {
                    return(CollectionDocument.SelectNodes("/Collection/Song") as IEnumerable <IXmlNode>);
                }
            }
            else
            {
                return(null);
            }
        }
 public static IEnumerable <IXmlNode> GetAllArtists()
 {
     if (IsCollectionLoaded)
     {
         return(CollectionDocument.SelectNodes("/Collection/Artist").OrderBy(node => ((XmlElement)node).GetAttribute("Name")) as IEnumerable <IXmlNode>);
     }
     else
     {
         return(null);
     }
 }
 public static IEnumerable <IXmlNode> GetSongsByArtistAndAlbum(string artistName, string albumName)
 {
     if (IsCollectionLoaded)
     {
         return(CollectionDocument.SelectNodes("/Collection/Song[@Artist=\"" + artistName + "\" and @Album=\"" + albumName + "\"]").OrderBy(x => ((XmlElement)x).GetAttribute("Title")) as IEnumerable <IXmlNode>);
     }
     else
     {
         return(null);
     }
 }
        public static List <string> GetSongsPathsByArtist(string artistName)
        {
            if (IsCollectionLoaded)
            {
                List <string> list = new List <string>();

                IXmlNode[] nodeList = CollectionDocument.SelectNodes("/Collection/Song[@Artist=\"" + artistName + "\"]").OrderBy(node => ((XmlElement)node).GetAttribute("Album")).ToArray();

                for (int i = 0; i < nodeList.Count(); i++)
                {
                    XmlElement element = nodeList[i] as XmlElement;

                    list.Add(element.GetAttribute("Path"));
                }

                return(list);
            }
            else
            {
                return(null);
            }
        }