public void WelcomeAction()
        {
            bool run = true;

            Console.WriteLine("\t\t\t\t\t*Hello! Welcome to the country app!*");
            while (run)
            {
                Console.WriteLine("\t\t~Would you like to select a country? Enter y to start or any other key twice to exit.~");
                string response = Console.ReadLine().ToLower();
                if (response == "y")
                {
                    CountryDataBase countryDataBase = new CountryDataBase();
                    CountryListView countryListView = new CountryListView(countryDataBase.Countries);
                    Console.WriteLine("Please select a country from the following list: ");
                    countryListView.Display();

                    int selection = int.Parse(Console.ReadLine());
                    CountryAction(countryDataBase.Countries[selection]);
                }
                else
                {
                    return;
                }
            }
        }
Esempio n. 2
0
        public void WelcomeAction()
        {
            // This will take no parameter and pass CountryDb into the CountryListView class.
            Console.WriteLine("\nHello, welcome to the country app. " +
                              "Please select a country from the following list:");

            CountryListView clv = new CountryListView(this.CountryDb);

            clv.Display();

            int selectedCountry = 0;

            while (!int.TryParse(Console.ReadLine(), out selectedCountry) ||
                   selectedCountry > this.CountryDb.Count ||
                   selectedCountry < 1)
            {
                Console.WriteLine("I'm sorry, I didn't understand. Please try again.");
            }

            // call CountryView
            this.CountryAction(CountryDb[selectedCountry - 1]);

            Console.WriteLine("Would you like to learn about another country?");
            string cont = Console.ReadLine();

            if (cont.Equals("y"))
            {
                WelcomeAction();
            }
        }
Esempio n. 3
0
        public void WelcomeAction()
        {
            string success1 = "y";

            while (success1 == "y")
            {
                IView view = new CountryListView(countryDb);
                Console.WriteLine("Hello welcome to the country app. Please select a country from the following list");
                view.Display();
                string choice  = Console.ReadLine().ToLower();
                bool   success = int.TryParse(choice, out int input);
                if (!success || input < 0)
                {
                    Console.WriteLine("Plesae enter a valid number");
                }
                else
                {
                    CountryAction(countryDb[input]);
                    Console.WriteLine("Would you like to learn about another country");
                    string choice1 = Console.ReadLine().ToLower();
                    if (choice1 == "n")
                    {
                        success1 = "n";
                        Console.WriteLine();;
                    }
                }
            }
        }
Esempio n. 4
0
        public void SecondAction()
        {
            CountryListView countries = new CountryListView(CountryDB);

            countries.Display();
            string answer = Console.ReadLine();
            int    index  = int.Parse(answer);

            Console.WriteLine();
            CountryAction(CountryDB[index]);
        }
Esempio n. 5
0
        public void WelcomeAction()
        {
            CountryListView cl = new CountryListView(CountryDb);

            Console.WriteLine("Hello, welcome to the country app. Please select from the following list: ");
            cl.Display();
            int input = int.Parse(Console.ReadLine());

            CountryAction(CountryDb[input]);

            Console.WriteLine("Would you like to learn about another country?");
        }
Esempio n. 6
0
        public void WelcomeAction()
        {
            CountryListView clv = new CountryListView(CountryDb);
            bool            run = true;

            Console.WriteLine("Hello, welcome to the country app.");
            while (run)
            {
                Console.WriteLine("Please select a country from the following list:");
                clv.Display();
                int userInput = Helper.GetIntFromUser("Choose a country to get more information: ");
                if (!(userInput < 0) && userInput < CountryDb.Count)
                {
                    CountryAction(CountryDb[userInput]);
                }
                run = Helper.GetYesOrNoFromUser("Would you like to learn about another Country?");
            }
        }
Esempio n. 7
0
        public void WelcomeAction()
        {
            CountryListView a = new CountryListView(CountryDB);

            Console.WriteLine("Hello, welcome to the country app. Please select a country from the following list: ");
            a.Display();

            for (int i = 0; i < CountryDB.Count; i++)
            {
                Country b = CountryDB[i];
                Console.WriteLine($"{i}: {b.Name}");
            }
            string answer = Console.ReadLine();
            int    index  = int.Parse(answer);

            Country output = CountryDB[index];

            CountryAction(CountryDB[index]);
        }