static void Main() { Console.WriteLine("\n\tMedia Player Interface Demo!"); var mediaPlayer = new DVDPlayer(); Console.WriteLine($"\tstreaming from: {mediaPlayer.DeviceName} totally rocks!"); mediaPlayer.Pause(); while (true) { Console.WriteLine("\tPush 'Up-Arrow' to Play"); Console.WriteLine("\tPush '[Spacebar]' to Pause"); Console.WriteLine("\tPush 'R' to Rewind"); Console.WriteLine("\tPush 'F' to FFwd"); Console.WriteLine("\tPush 'S' to Stop"); switch (Console.ReadKey().Key) { case ConsoleKey.F: mediaPlayer.Ffwd(); break; case ConsoleKey.R: mediaPlayer.Rewind(); break; case ConsoleKey.S: mediaPlayer.Stop(); break; case ConsoleKey.UpArrow: mediaPlayer.Play(); break; case ConsoleKey.Spacebar: mediaPlayer.Pause(); break; } } }
static void Main(string[] args) { DVDPlayer dvdPlayer = new DVDPlayer(); Lights lights = new Lights(); MusicPlayer musicPlayer = new MusicPlayer(); Projector projector = new Projector(); HomeTheaterFacade homeTheater = new HomeTheaterFacade(dvdPlayer, lights, musicPlayer, projector); homeTheater.WatchMovie("Bad grandpa"); System.Threading.Thread.Sleep(2000); dvdPlayer.Pause(); dvdPlayer.Continue(); homeTheater.StopMovie(); }
static void Main(string[] args) { Console.WriteLine("Media Player Interface Demo"); DVDPlayer mediaPlayer1 = new DVDPlayer(); Console.WriteLine($"{mediaPlayer1.DeviceName}"); mediaPlayer1.DeviceName = "DVD Player"; Console.WriteLine($"{mediaPlayer1.DeviceName}"); string input; Console.WriteLine(">.Press Play\nP.Press Pause\nF.Press FFwd\nR.Press Rewind\nS.Press Stop\n0.To Exit"); while (true) { input = Console.ReadLine(); switch (input) { case ">": mediaPlayer1.Play(); break; case "P": mediaPlayer1.Pause(); break; case "F": mediaPlayer1.Ffwd(); break; case "R": mediaPlayer1.Rewind(); break; case "S": mediaPlayer1.Stop(); break; case "0": return; default: Console.WriteLine("Incorrect Input, try again..."); break; } } }
static void Main(string[] args) { Console.WriteLine("Media Player Demo!"); var mediaPlayer = new DVDPlayer(); Console.WriteLine($"\tStreaming from: {mediaPlayer.DeviceName}."); while (true) { Console.WriteLine("\tPush Up-Arrow to Play"); Console.WriteLine("\tPush [Spacebar] to Stop"); Console.WriteLine("\tPush F to Ffwd"); Console.WriteLine("\tPush R to Rewind"); Console.WriteLine("\tPush P to Pause"); switch (Console.ReadKey().Key) { case ConsoleKey.RightArrow: mediaPlayer.Ffwd(); break; case ConsoleKey.LeftArrow: mediaPlayer.Rewind(); break; case ConsoleKey.Spacebar: mediaPlayer.Stop(); break; case ConsoleKey.DownArrow: mediaPlayer.Pause(); break; case ConsoleKey.UpArrow: mediaPlayer.Play(); break; } } }