예제 #1
0
파일: Task4.cs 프로젝트: SyrnikovEK/csharp
        public void DoSomething()
        {
            int menu = 0;
            DocumentWorker worker;
            Console.WriteLine("Input key");
            menu = int.Parse(Console.ReadLine());
            switch (menu)
            {
                case 1:
                    {
                        worker = new ProDocumentWorker();
                        break;
                    }
                case 2:
                    {
                        worker = new ExpertDocumentWorker();
                        break;
                    }
                default:
                    {
                        worker = new DocumentWorker();
                        break;
                    }
            }

            worker.OpenDocument();
            worker.EditDocument();
            worker.SaveDocument();

            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            if (ver == 1)
            {
                dw = dw1;
            }
            if (ver == 2)
            {
                dw = dw2;
            }

            string command = Console.ReadLine();

            if (openreg.IsMatch(command))
            {
                dw.OpenDocument();
            }
            if (editreg.IsMatch(command))
            {
                dw.EditDocument();
            }
            if (savereg.IsMatch(command))
            {
                dw.SaveDocument();
            }
            Main(null);
        }
예제 #3
0
        public void DoSomething()
        {
            int            menu = 0;
            DocumentWorker worker;

            Console.WriteLine("Input key");
            menu = int.Parse(Console.ReadLine());
            switch (menu)
            {
            case 1:
            {
                worker = new ProDocumentWorker();
                break;
            }

            case 2:
            {
                worker = new ExpertDocumentWorker();
                break;
            }

            default:
            {
                worker = new DocumentWorker();
                break;
            }
            }

            worker.OpenDocument();
            worker.EditDocument();
            worker.SaveDocument();

            Console.ReadKey();
        }
예제 #4
0
        static void Main(string[] args)
        {
            DocumentWorker documentWorker = DocumentWorker.OpenWorker("exp");

            documentWorker.OpenDocument();
            documentWorker.SaveDocument();
            documentWorker.EditDocument();
            Console.ReadKey();
        }
예제 #5
0
        static void Main(string[] args)
        {
            string pro_key = "profi";
            string exp_key = "expert";
            string pro, exp;

            Console.WriteLine("Введите ключ для версии Про:");
            pro = Console.ReadLine();
            if (pro != pro_key)
            {
                DocumentWorker user1 = new DocumentWorker();
                Console.WriteLine("document status:");
                user1.OpenDocument();
                user1.EditDocument();
                user1.SaveDocument();
            }
            else
            {
                Console.WriteLine("Введите ключ для версии Эксперт:");
                exp = Console.ReadLine();
                if (exp != exp_key)
                {
                    ExpertDocumentWorker user1 = new ExpertDocumentWorker();
                    Console.WriteLine("document status:");
                    user1.OpenDocument();
                    user1.EditDocument();
                    user1.SaveDocument();
                }
                else
                {
                    ProDocumentWorker user1 = new ProDocumentWorker();
                    Console.WriteLine("document status:");
                    user1.OpenDocument();
                    user1.EditDocument();
                    user1.SaveDocument();
                }
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            InheritanceColor print = new InheritanceColor(ConsoleColor.Yellow);

            print.Print("Hello");

            Printer printUp = print;

            printUp.Print("Hello");

            InheritanceColor print1 = new InheritanceColor(ConsoleColor.Red);

            print1.Print("Hello");


            Console.WriteLine(new string('-', 50));


            Pupil p1 = new BadPupil();
            Pupil p2 = new ExcelentPupil();

            ClassRoom group = new ClassRoom(p1, p2);

            group.Study();
            group.Read();
            group.Write();
            group.Relax();


            Console.WriteLine(new string('-', 50));


            Ship ship = new Ship(20000, 120, 2000)
            {
                Passengers = 28, Port = "Odessa"
            };

            Console.WriteLine("Ship price {0}, speed {1}, year of manufacture {2}, number of passengers {3}, port of registry {4}", ship.Price, ship.Speed, ship.Year, ship.Passengers, ship.Port);


            Console.WriteLine(new string('-', 50));


            Console.WriteLine("Enter Key");
            string         key = Console.ReadLine();
            DocumentWorker doc = null;

            switch (key)
            {
            case "pro":
                doc = new ProDocumentWorker();
                break;

            case "expert":
                doc = new ExpertDocumentWorker();
                break;

            default:
                Console.WriteLine("Key is incorrect");
                doc = new DocumentWorker();
                break;
            }

            doc.OpenDocument();
            doc.EditDocument();
            doc.SaveDocument();

            Console.ReadKey();
        }
 public void OpenDocumentTest()
 {
     Assert.AreEqual("Документ открыт", _target.OpenDocument());
 }
예제 #8
0
        static void Main(string[] args)
        {
            const string proKey = "pro";
            const string expKey = "exp";

            Console.WriteLine("Введите ключ");
            string         key      = Console.ReadLine();
            DocumentWorker document = new DocumentWorker();

            switch (key)
            {
            case proKey:
                document = new ProDocumentWorker();
                break;

            case expKey:
                document = new ExpertDocumentWorker();
                break;

            default:
                document = new DocumentWorker();
                break;
            }
            Console.WriteLine("Введите команды для работы с документом: \n1-Открыть документ, \n2-Редактировать документ, \n3-Сохранить, \n4-выход");
            bool A = true;

            while (A == true)
            {
                switch (Console.ReadLine())
                {
                case "1":
                    Console.ForegroundColor = ConsoleColor.DarkMagenta; document.OpenDocument(); Console.ForegroundColor = ConsoleColor.White;
                    break;

                case "2":
                    Console.ForegroundColor = ConsoleColor.DarkMagenta; document.EditDocument(); Console.ForegroundColor = ConsoleColor.White;
                    break;

                case "3":
                    Console.ForegroundColor = ConsoleColor.DarkMagenta; document.SaveDocument(); Console.ForegroundColor = ConsoleColor.White;
                    break;

                case "4":
                    A = false; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Выход"); Console.ForegroundColor = ConsoleColor.White;
                    break;

                default:
                    Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Неправильная команда!"); Console.ForegroundColor = ConsoleColor.White;
                    break;
                }
            }


            IPlayable player = new Player();

            Console.ForegroundColor = ConsoleColor.DarkCyan;
            player.Play();
            player.Pause();
            player.Stop();
            Console.WriteLine();
            IRecordable recorder = new Player();

            Console.ForegroundColor = ConsoleColor.Cyan;
            recorder.Record();
            recorder.Pause();
            recorder.Stop();
            Console.ForegroundColor = ConsoleColor.White;
            Console.ReadKey();
        }