Beispiel #1
0
        static void Main(string[] args)
        {
            Console.Write("Select the mode: ");
            string mode   = Console.ReadLine();
            Player player = new Player();

            switch (mode.ToLower())
            {
            case "record":
                Console.WriteLine("Available action in this mode:");
                IRecodable recodable = player as IRecodable;
                recodable.Record();
                recodable.Pause();
                recodable.Stop();
                break;

            case "play":
                Console.WriteLine("Available action in this mode:");
                IPlayable playable = player as IPlayable;
                playable.Play();
                playable.Pause();
                playable.Stop();
                break;

            default:
                Console.WriteLine("The mode is not exist.");
                break;
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Player     player = new Player();
            IRecodable ir     = player as IRecodable;

            ir.Record();
            Console.ReadLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Player     player    = new Player();
            IPlayable  playable  = player;
            IRecodable recodable = player as IRecodable;

            playable.Play();
            playable.Pause();
            recodable.Record();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Player     player    = new Player();
            IRecodable recodable = player as IRecodable;

            recodable.Record();
            recodable.Pause();
            recodable.Stop();
            Console.WriteLine(new string('-', 50));
            IPlayable playable = player as IPlayable;

            playable.Play();
            playable.Pause();
            playable.Stop();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Player pl = new Player();

            IPlayable  ipl = pl;
            IRecodable irc = pl;

            ipl.Play();
            irc.Record();

            Console.WriteLine(ipl.GetHashCode());
            Console.WriteLine(irc.GetHashCode());
            Console.WriteLine(pl.GetHashCode());
            Console.ReadKey();
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            IPlayable player = new Player();

            player.Play();
            player.Stop();
            player.Pause();
            Console.WriteLine(new string('*', 80));

            IRecodable player1 = player as IRecodable;

            player1.Record();
            player1.Pause();
            player1.Stop();
        }
Beispiel #7
0
        private static void Main(string[] args)
        {
            Player    player     = new Player();
            IPlayable playPlayes = player;

            playPlayes.Play();
            playPlayes.Pause();
            playPlayes.Stop();

            IRecodable recordPlayes = player;

            recordPlayes.Record();
            recordPlayes.Pause();
            recordPlayes.Stop();

            Console.Read();
        }
Beispiel #8
0
        /* Створіть 2 інтерфейсу IPlayable і IRecodable. У кожному з інтерфейсів створіть по 3 методу
         * voidPlay () / voidPause () / voidStop () і voidRecord () / voidPause () / voidStop () відповідно.
         * Створіть похідний клас Player від базових інтерфейсів IPlayable і IRecodable. Написати програму, яка виконує програвання і запис.*/

        static void Main(string[] args)
        {
            Player myPlay = new Player();

            IPlayable myPlayer = myPlay as IPlayable;

            myPlayer.Play();
            myPlayer.Pause();
            myPlayer.Stop();

            IRecodable myRecorder = myPlay as IRecodable;

            myRecorder.Record();
            myRecorder.Pause();
            myRecorder.Stop();

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Work of the player");
            IPlayable player = new Player();

            player.Play();
            player.Pause();
            player.Stop();

            Console.WriteLine("Work of the recorder:");
            IRecodable recorder = (IRecodable)player;

            recorder.Record();
            recorder.Pause();
            recorder.Stop();

            Console.ReadKey();
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            Player    player = new Player();
            IPlayable ip     = player as IPlayable;

            ip.Play();
            ip.Pause();
            ip.Stop();

            Console.WriteLine();

            IRecodable ir = player as IRecodable;

            ir.Record();
            ir.Pause();
            ir.Stop();

            Console.ReadLine();
        }
Beispiel #11
0
            public static void Show(IRecodable player)
            {
                string answer = String.Empty;

                do
                {
                    Console.WriteLine("Выберите действие с записью:");
                    Console.WriteLine("0 - Выход");
                    Console.WriteLine("1 - Выполнить запись");
                    Console.WriteLine("2 - Приостановить запись");
                    Console.WriteLine("3 - Остановить запись");

                    answer = Console.ReadLine();
                    Console.WriteLine("\n");

                    switch (answer)
                    {
                    case "0":
                        Console.WriteLine("Выполняем выход...");
                        break;

                    case "1":
                        player.Record();
                        break;

                    case "2":
                        player.Pause();
                        break;

                    case "3":
                        player.Stop();
                        break;

                    default:
                        Console.WriteLine("Некорректное действие, попробуйте еще раз...");
                        break;
                    }
                    Console.WriteLine("\n");
                } while (answer != "0");
            }
        /// <summary>
        /// Установить действия плеера в режиме записи песен
        /// </summary>
        /// <param name="playerRecording"> Режим записи песен </param>
        /// <param name="action"> Действие </param>
        private static void SetRecordingActions(IRecodable playerRecording, int action)
        {
            switch (action)
            {
            case 1:
            {
                playerRecording.Record();
                break;
            }

            case 2:
            {
                playerRecording.Pause();
                break;
            }

            default:
            {
                playerRecording.Stop();
                break;
            }
            }
        }