static void Main(string[] args) { Console.WriteLine("Please, enter the access key: "); string accessKey = Console.ReadLine(); DocumentWorker doc = null; if (accessKey == "prof") { doc = new ProDocumentWorker(); } else if (accessKey == "expert") { doc = new ExpertDocumentWorker(); } else { Console.WriteLine("Wrong access key"); doc = new DocumentWorker(); } doc.OpenDocument(); doc.EditDocument(); doc.SaveDocument(); Console.ReadKey(); }
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(); }
static void Main(string[] args) { Console.WriteLine("Введите версию документа Pro, Exp, Free"); string key = Console.ReadLine(); DocumentWorker doc; switch (key) { case "Pro": doc = new ProDocumentWorker(); break; case "Exp": doc = new ExpertDocumentWorker(); break; default: Console.WriteLine("Введен неправильный формат или выбрана бесплатная версия"); doc = new DocumentWorker(); break; } doc.OpenDocument(); doc.EditDocument(); doc.SaveDocument(); Console.ReadKey(); }
static void Main(string[] args) { int key; DocumentWorker documentWorker; Console.WriteLine("Введите ключ пользователя"); Console.WriteLine("0 - базовый, 1 - Pro, 2 - Expert"); key = InputUsersKey(); if (key == (int)version.Base) { documentWorker = new DocumentWorker(); } else if (key == (int)version.Pro) { documentWorker = new ProDocumentWorker(); } else { documentWorker = new ExpertDocumentWorker(); } documentWorker.Show(); Console.ReadKey(); }
static DocumentWorker WorkWithDocument(string version) { DocumentWorker doc; if (version == "pro") { doc = new ProDocumentWorker(); } else if (version == "exp") { doc = new ExpertDocumentWorker(); } else { doc = new DocumentWorker(); } return(doc); }
static void Main(string[] args) { DocumentWorker worker; bool isExecuting = true; while (isExecuting) { Console.WriteLine("Введите ключи доступа:"); string key = Console.ReadLine(); switch (key) { case "AAA-123-456-789": worker = new ProDocumentWorker(); break; case "ZZZ-147-258-369": worker = new ExpertDocumentWorker(); break; default: worker = new DocumentWorker(); break; } switch (key) { case "q": isExecuting = false; Console.WriteLine("Произведен выход из программы"); continue; } worker.OpenDocument(); worker.EditDocument(); worker.SaveDocument(); Console.WriteLine(new string('-', 50) + "\n"); } Console.ReadLine(); }
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(); } } }
static void Main(string[] args) { DocumentWorker dw; Console.Write("Enter the key:"); string key = Console.ReadLine(); if (key == KeyForPRO_License) { dw = new ProDocumentWorker(); } else if (key == KeyForEXP_License) { dw = new ExpertDocumentWorker(); } else { dw = new DocumentWorker(); } dw.OpenDocument(); dw.SaveDocument(); dw.EditDocument(); Console.ReadKey(); }
static void Main(string[] args) { DocumentWorker docwor; Console.Write("Enter key: "); string key = Console.ReadLine(); if (key == "pro") { docwor = new ProDocumentWorker(); } else if (key == "exp") { docwor = new ExpertDocumentWorker(); } else { docwor = new DocumentWorker(); } docwor.OpenDocument(); docwor.EditDocument(); docwor.SaveDocument(); }
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 Init() { _target = new ExpertDocumentWorker(); }
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(); }