示例#1
0
 /// <summary>
 /// Stops the mp3 player.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Stop_Click(object sender, EventArgs e)
 {
     if (!IsSongStopped())
     {
         _mp3Player.Stop();
         songTimer.Stop();
         SetSongTimer(new TimeSpan(0, 0, 0));
     }
 }
示例#2
0
        static void Main()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("MP3 Player");
                Console.WriteLine("Press:");
                Console.WriteLine("Space - Pause/Start");
                Console.WriteLine("Arrows Up/Down - volume Increase/Decrease");
                Console.WriteLine("Esc - stop");
                Mp3Player game = new Mp3Player();
                while (true)
                {
                    Console.WriteLine("Enter the full path to song:");
                    string path = Console.ReadLine();
                    if (!game.Path(path))
                    {
                        Console.WriteLine("Wrong path! Enter again");
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                bool flag = true;
                while (flag)
                {
                    ConsoleKey key = Console.ReadKey(true).Key;
                    switch (key)
                    {
                    case ConsoleKey.Escape:
                        game.Stop();
                        flag = false;
                        break;

                    case ConsoleKey.Spacebar:
                        game.Pause();
                        break;

                    case ConsoleKey.UpArrow:
                        game.Volume += 10;
                        break;

                    case ConsoleKey.DownArrow:
                        game.Volume -= 10;
                        break;
                    }
                }
            }
        }