public SubMenu(HogwartsMethods hogwarts, ICharactersDAO charactersDAO)
        {
            this.hogwarts      = hogwarts;
            this.charactersDAO = charactersDAO;
            AddOption("1. Hogwarts, A History", GetHHistory);
            AddOption("2. List of Harry Potter Characters", HPList);
            AddOption("3. Search for Characters by House", ByHouse);

            Configure(cfg =>
            {
                cfg.ItemForegroundColor         = ConsoleColor.Gray;
                cfg.SelectedItemForegroundColor = ConsoleColor.Blue;
            });
        }
Example #2
0
        static void Main(string[] args)
        {
            IConfigurationBuilder builder = new ConfigurationBuilder();

            builder.AddJsonFile("connection.json", optional: true, reloadOnChange: true);
            IConfigurationRoot configuration    = builder.Build();
            string             connectionString = configuration.GetConnectionString("HarryPotter");
            IStudentDAO        studentDAO       = new StudentSqlDAO(connectionString);

            string          filePath         = @"C:\Users\Student\Desktop\HogwartsSideProject\hogwartshouses.txt";
            string          filePath2        = @"C:\Users\Student\Desktop\HogwartsSideProject\hogwarts.txt";
            HogwartsLoader  hogwartsLoader   = new HogwartsLoader(filePath);
            HogwartsMethods hogwarts         = new HogwartsMethods(hogwartsLoader.HouseList, filePath, filePath2);
            ICharactersDAO  charactersApiDAO = new CharactersApiDAO(API_URL);
            MainMenu        menu             = new MainMenu(hogwarts, charactersApiDAO, studentDAO);

            menu.Show();
        }
Example #3
0
        public MainMenu(HogwartsMethods hogwarts, ICharactersDAO charactersDAO, IStudentDAO studentDAO)
        {
            this.hogwarts      = hogwarts;
            this.charactersDAO = charactersDAO;
            this.studentDAO    = studentDAO;
            AddOption("1. Get Sorted", GetSorted);
            AddOption("2. About Hogwarts", SubMenu);
            AddOption("3. Add New Student", AddStudent);
            AddOption("4. Look Up Classmates", LookUpClass);
            AddOption("Exit", Exit);

            Configure(cfg =>
            {
                Console.ForegroundColor = ConsoleColor.DarkGray;
                cfg.Title = FiggleFonts.Ogre.Render("Hogwarts");
                cfg.ItemForegroundColor         = ConsoleColor.Gray;
                cfg.SelectedItemForegroundColor = ConsoleColor.Blue;
            });
        }