public static void PlayFunc(IPlayable player1, IRecordable player2) { player1.Play(); Console.WriteLine("Please select the next command: record, pause or stop!"); string action = Console.ReadLine(); switch (action) { case "record": player2.Record(); RecordFunc(player1, player2); break; case "pause": player1.Pause(); Console.WriteLine("Please select your next step: stop or play again!"); string actionNext = Console.ReadLine(); switch (actionNext) { case "stop": player1.Stop(); break; case "play": PlayFunc(player1, player2); break; default: Console.WriteLine("Please select a valid command!"); break; } break; case "stop": player1.Stop(); break; default: Console.WriteLine("Please select a valid command!"); break; } }
static void Main(string[] args) { string myFile = "myFile"; new XMLHandler(myFile).ShowInfoXML(); new DOCHandler(myFile).ShowInfoDOC(); new TXTHandler(myFile).ShowInfoTXT(); new ExDevider("Ex3"); Player myPlayer = new Player(); IRecordable myRecorder = myPlayer as IRecordable; IPlayeble myPlayeble = myPlayer as IPlayeble; IEnumerable instance = new ArrayList(); Console.ReadKey(); instance = instance as IQueryable; myPlayeble.Play(); myRecorder.Record(); myPlayeble.Stop(); myRecorder.Stop(); Console.ReadKey(); }
static void Main(string[] args) { Player player = new Player(); IRecordable recordDevice = player; IPlayable playerDevice = player; recordDevice.Record(); recordDevice.Pause(); recordDevice.Stop(); playerDevice.Play(); playerDevice.Pause(); playerDevice.Stop(); Console.ReadLine(); }
static void Main(string[] args) { Player player = new Player(); IPlayable music = player; music.Play(); music.Pause(); music.Stop(); IRecordable recorder = player; recorder.Record(); recorder.Pause(); recorder.Stop(); Console.ReadKey(); }
static void Main(string[] args) { Player player = new Player(); IPlayeble playeblaPlayer = player as IPlayeble; playeblaPlayer.Play(); playeblaPlayer.Stop(); playeblaPlayer.Pause(); IRecordable recoPlayer = player as IRecordable; recoPlayer.Record(); recoPlayer.Pause(); recoPlayer.Stop(); Console.ReadLine(); }
//Создайте 2 интерфейса IPlayable и IRecodable.В каждом из интерфейсов создайте по 3 метода void Play() / void Pause() / void Stop() и void Record() / void Pause() / void Stop() соответственно. //Создайте производный класс Player от базовых интерфейсов IPlayable и IRecodable. //Написать программу, которая выполняет проигрывание и запись. static void Main() { Player player = new Player(); IPlayable playable = player; IRecordable recordable = player; player.Play(); playable.Pause(); ((IPlayable)player).Stop(); Console.WriteLine(); recordable.Record(); recordable.Pause(); (player as IRecordable).Stop(); Console.ReadLine(); }
static void Main(string[] args) { Player player = new Player(); IRecordable irec = player; IPlayable ipl = player; irec.Record(); irec.Pause(); irec.Stop(); Console.WriteLine(); ipl.Play(); ipl.Pause(); ipl.Stop(); Console.WriteLine(); Console.ReadLine(); }
static void Main(string[] args) { Player player = new Player(); Console.WriteLine("***Player***"); IPlayable player1 = player; player1.Play(); player1.Pause(); player1.Stop(); Console.WriteLine(); Console.WriteLine("***Recorder***"); IRecordable recorder = player; recorder.Record(); recorder.Pause(); recorder.Stop(); Console.ReadKey(); }
private void btRecord_Click(object sender, EventArgs e) => _recorder.Record();