コード例 #1
0
ファイル: Program.cs プロジェクト: Ugine78/BridgeTest
        static void Main(string[] args)
        {
            MySuperSmartTV myTv = new MySuperSmartTV();

            Console.WriteLine("Select A source to get TV Guide and Play");
            Console.WriteLine("1. Local Cable TV\n2. Local Dish TV\n3. IP TV");

            ConsoleKeyInfo input = Console.ReadKey();

            // Тут ми вибираємо ресурс відповідно до вибору користувача
            switch (input.KeyChar)
            {
                case '1':
                    myTv.VideoSource = new LocalCabelTv();
                    break;

                case '2':
                    myTv.VideoSource = new LocalDishTv();
                    break;

                case '3':
                    myTv.VideoSource = new IPTvService();
                    break;
            }

            Console.WriteLine(); //Виводимо порожній рядок для кращого вигляду

            //Показуємо користувачу телегід для вибраного ресурсу
            myTv.ShowTvGuide();

            //Відтворюємо вибраний ресурс
            myTv.PlayTV();

            Console.WriteLine(); //Виводимо порожній рядок для кращого вигляду
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Ugine78/BridgeTest
        static void Main(string[] args)
        {
            MySuperSmartTV myTv = new MySuperSmartTV();

            Console.WriteLine("Select A source to get TV Guide and Play");
            Console.WriteLine("1. Local Cable TV\n2. Local Dish TV\n3. IP TV");

            ConsoleKeyInfo input = Console.ReadKey();

            // Let us see what user has selected and select the video source accrodingly
            switch (input.KeyChar)
            {
                case '1':
                    myTv.VideoSource = new LocalCabelTv();
                    break;

                case '2':
                    myTv.VideoSource = new LocalDishTv();
                    break;

                case '3':
                    myTv.VideoSource = new IPTvService();
                    break;
            }

            Console.WriteLine(); //some whitespace on output for readability

            //Let us show the TV guide from selected source
            myTv.ShowTvGuide();

            //Let us now play the selected TV source.
            myTv.PlayTV();

            Console.WriteLine(); //some whitespace on output for readability
        }
コード例 #3
0
        static void Main(string[] args)
        {
            MySuperSmartTV myTv = new MySuperSmartTV();

            Console.WriteLine("Select A source to get TV Guide and Play");
            ConsoleKeyInfo input;

            do
            {
                Console.WriteLine("1. Local Cable TV\n2. Local Dish TV\n3. IP TV\n4. For turn off TV");

                input = Console.ReadKey();
                // Запитуємо у користувача, яке джерело прийому він хоче використовувати
                switch (input.KeyChar)
                {
                case '1':
                    myTv.VideoSource = new LocalCabelTv();
                    break;

                case '2':
                    myTv.VideoSource = new LocalDishTv();
                    break;

                case '3':
                    myTv.VideoSource = new IPTvService();
                    break;

                case '4':
                    Console.WriteLine("\nBye");
                    return;
                }
                Console.WriteLine();
                //Відображаємо TvGuide
                myTv.ShowTvGuide();
                //Працюємо з необхідним джерелом TV
                myTv.PlayTV();
                Console.WriteLine();
            }while (true);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            MySuperSmartTV myTv = new MySuperSmartTV();

            Console.WriteLine("Select A source to get TV Guide and Play");
            Console.WriteLine("1. Local Cable TV\n2. Local Dish TV\n3. IP TV");

            ConsoleKeyInfo input = Console.ReadKey();

            // Let us see what user has selected and select the video source accrodingly
            switch (input.KeyChar)
            {
            case '1':
                myTv.VideoSource = new LocalCabelTv();
                break;

            case '2':
                myTv.VideoSource = new LocalDishTv();
                break;

            case '3':
                myTv.VideoSource = new IPTvService();
                break;
            }

            Console.WriteLine(); //some whitespace on output for readability

            //Let us show the TV guide from selected source
            myTv.ShowTvGuide();

            //Let us now play the selected TV source.
            myTv.PlayTV();

            Console.WriteLine(); //some whitespace on output for readability
            Console.ReadKey();
        }