static void Main(string[] args) { DBTeahcer dBTeahcer = new DBTeahcer(); DBSubjects dBSubjects = new DBSubjects(); DBTeacherSubject dBTeacherSubject = new DBTeacherSubject(); SubjectMenu subjectMenu = new SubjectMenu(dBSubjects); MenuTeacher menuTeacher = new MenuTeacher(dBTeahcer); MenuTeacherSubject menuTeacherSubject = new MenuTeacherSubject(dBTeacherSubject); MainMenuStrategy mainMenuStrategy = new MainMenuStrategy(menuTeacher, subjectMenu, menuTeacherSubject); Menu mainMenu = new Menu(mainMenuStrategy); mainMenu.Run(); }
static void Main(string[] args) { DBTeahcer dBTeahcer = new DBTeahcer(); DBSubjects dBSubjects = new DBSubjects(); SubjectMenu subjectMenu = new SubjectMenu(dBSubjects); MenuTeacher menuTeacher = new MenuTeacher(dBTeahcer); bool exit = false; do { Console.WriteLine(new string('-', 20) + "Menu" + new string('-', 20)); Console.WriteLine("Press the key number of menu"); Console.WriteLine("1 - Teacher menu"); Console.WriteLine("2 - Subject menu"); Console.WriteLine("0 - Exit"); switch (Console.ReadKey(true).Key) { case ConsoleKey.D1: menuTeacher.Run(); Console.WriteLine(); break; case ConsoleKey.D2: subjectMenu.Run(); break; case ConsoleKey.D0: Console.WriteLine("Good by!"); exit = true; break; default: Console.WriteLine("Wrong key command!"); break; } }while (!exit); }