示例#1
0
        public static bool PlaySong(String name)
        {
            if (SongHelper.songs == null)
            {
                SongHelper.GetSongs();
            }

            foreach (Song s in SongHelper.songs)
            {
                if (s.Name.ToString().Equals(name))
                {
                    SongHelper.Play(s);
                    return(true);
                }
            }
            return(false);
        }
示例#2
0
        public static bool PlayRandom()
        {
            if (SongHelper.songs == null)
            {
                SongHelper.GetSongs();
            }

            if (songs.Count == 0)
            {
                return(false);
            }

            Random rand = new Random();

            SongHelper.Play(SongHelper.songs, (Int32)rand.Next(songs.Count - 1));
            return(true);
        }