Example #1
0
        static void ActionsInPlayer()
        {
            Player player = new Player();

            Console.WriteLine("Выберите действие: 1 - воспроизвидение муз. 2 - запись звука");
            int action = int.Parse(Console.ReadLine());

            switch (action)
            {
            case 1:
                player.Play();

                Console.WriteLine("Следующее действие муз.устройства: 1 - Пауза; 2 - Остановить; 3 - Выход;");
                int       newAction = int.Parse(Console.ReadLine());
                IPlayable iPlayable = (IPlayable)player;
                switch (newAction)
                {
                case 1:
                    iPlayable.Pause();
                    break;

                case 2:
                    iPlayable.Stop();
                    break;

                case 3:
                    break;
                }
                break;

            case 2:
                player.Record();
                Console.WriteLine("Следующее действие записывающего устройства: 1 - Пауза; 2 - Остановить; 3 - Выход;");
                int        nextAction = int.Parse(Console.ReadLine());
                IRecodable iRecodable = (IRecodable)player;
                switch (nextAction)
                {
                case 1:
                    iRecodable.Pause();
                    break;

                case 2:
                    iRecodable.Stop();
                    break;

                case 3:
                    break;
                }
                break;

            default:
                Console.WriteLine("Ошибка выбора");
                break;
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            Player player = new Player();
            player.Play(); //IPlayable
            ((IRecodable)player).Record();

            IPlayable inter = new Player();
            inter.Stop();
            
            Console.ReadLine();
        }
        static void ActionsInPlayer()
        {
            Player player = new Player();
            Console.WriteLine("Выберите действие: 1 - воспроизвидение муз. 2 - запись звука");
            int action = int.Parse(Console.ReadLine());
            switch (action)
            {
                case 1:
                    player.Play();

                    Console.WriteLine("Следующее действие муз.устройства: 1 - Пауза; 2 - Остановить; 3 - Выход;");
                    int newAction = int.Parse(Console.ReadLine());
                    IPlayable iPlayable = (IPlayable)player;
                    switch (newAction)
                    {
                        case 1:
                            iPlayable.Pause();
                            break;
                        case 2:
                            iPlayable.Stop();
                            break;
                        case 3:
                            break;
                    }
                    break;
                case 2:
                    player.Record();
                    Console.WriteLine("Следующее действие записывающего устройства: 1 - Пауза; 2 - Остановить; 3 - Выход;");
                    int nextAction = int.Parse(Console.ReadLine());
                    IRecodable iRecodable = (IRecodable)player;
                    switch (nextAction)
                    {
                        case 1:
                            iRecodable.Pause();
                            break;
                        case 2:
                            iRecodable.Stop();
                            break;
                        case 3:
                            break;
                    }
                    break;
                default:
                    Console.WriteLine("Ошибка выбора");
                    break;
            }
        }     
Example #4
0
        static void Main(string[] args)
        {
            IPlayable  playable  = new Player();
            IRecodable recodable = new Player();

            playable.Play();
            playable.Pause();
            playable.Stop();

            Console.WriteLine();

            recodable.Record();
            recodable.Pause();
            recodable.Stop();


            Console.ReadKey();
        }
Example #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Player#1");
            Player Player1 = new Player();

            Player1.Play();
            (Player1 as IPlayable).Stop();
            Player1.Record();
            (Player1 as IRecodable).Stop();


            Console.WriteLine("Player#2");
            Player Player2 = new Player();

            Player2.Play();
            (Player2 as IPlayable).Stop();
            Player2.Record();
            (Player2 as IRecodable).Stop();
        }
Example #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Type QUIT to quit from player");
            Player p = new Player();

            while (true)
            {
                Console.WriteLine("\nInput operation (play/record/pause/stop):");
                string action = Console.ReadLine();

                switch (action)
                {
                case "play":
                    p.Play();
                    break;

                case "record":
                    p.Record();
                    break;

                case "pause":
                    p.Pause();
                    break;

                case "stop":
                    p.Stop();
                    break;

                case "QUIT":
                    return;

                default:
                    Console.WriteLine("Unknown operation");
                    break;
                }
            }
        }