예제 #1
0
        /// <summary>
        /// While within the Castle Display View bring up a menu that asks if
        /// you would like to add a specific castle to the wishlist. By inputing
        /// the castles name into the console the user can add that castle to their
        /// wishlist.
        /// </summary>
        /// <param name="castlesInfo">The list of castles to display to the user.</param>
        public void WishlistAdditionCastleView(Dictionary <string, Dictionary <string, List <string> > > castlesInfo)
        {
            bool   bExit = false;
            string userInput, castleName;
            int    answer;

            while (!bExit)
            {
                ConsoleDisplay.FormatAndDisplayCastles("Castle List View", castlesInfo);

                do
                {
                    ConsoleDisplay.DisplayAddToWishlist();
                    userInput = Console.ReadLine();
                    answer    = ConsoleUtil.TryUserInputConvert(userInput);
                } while (answer < 1 || answer > 2);

                switch (answer)
                {
                case 1:
                    // Add to wishlist
                    ConsoleDisplay.DisplayEnterToWishlist();
                    castleName = Console.ReadLine();
                    if (!OnSaveToWishlistEvent(castleName))
                    {
                        ConsoleDisplay.ErrorCastleNotFound(castleName);
                    }
                    else
                    {
                        ConsoleDisplay.DisplayAddedToWishlist(castleName);
                    }
                    break;

                case 2:
                    // Exit back to searching
                    bExit = true;
                    break;
                }
            }
        }