Пример #1
0
    {//This file will handle the logic needed to run the menus in the userInterface.
        static void Main(string[] args)
        {
            //****************************
            //Class Variables
            //****************************

            //Create an instance of the WineAPI for use in program
            WineAPI wineItemCollection = new WineAPI();

            //Instance of the UserInterface class to run the menus'
            UserInterface ui = new UserInterface();

            //Start the User Interface and initialize it
            ui.StartUserInterface();

            //Start the main menu and wit for user input
            int choice = ui.GetUserInputMainMenu();

            //As long as the user does not choose 5 for exiting loop through the main menu
            while (choice != 6)
            {
                switch (choice)
                {
                case 1:    //Go to the Print Wine List Menu in the User Interface
                    ui.GetUserInputPrintWineListMenu(wineItemCollection);
                    break;

                case 2:    //Go to the method SearchForWineAndPossiblyDelete and choose search only
                    SearchForWineAndPossiblyDelete(wineItemCollection, false);
                    break;

                case 3:    //Go to the method in the User Interface to add a wine item
                    ui.AddWine(wineItemCollection);
                    break;

                case 4:    //Go to the method SearchForWineAndPossiblyDelete and choose search and delete
                    SearchForWineAndPossiblyDelete(wineItemCollection, true);
                    break;

                case 5:
                    ui.GetUserInputToUpdateAWine(wineItemCollection);
                    break;
                }
                choice = ui.GetUserInputMainMenu();
            }
        }