/// <summary> /// The show main menu. /// </summary> private void ShowMainMenu() { var input = string.Empty; while (true) { Console.Clear(); _consolePrinter.PrintCenteredHeader("Main Menu"); if (_wishlistDictionary != null) { foreach (KeyValuePair <int, IWishlist> wishlist in _wishlistDictionary) { _consolePrinter.PrintMainMenuWishlistItem(wishlist.Key, wishlist.Value); } } else { Console.WriteLine("No wishlists to show."); } MainMenuOption(); input = Console.ReadLine(); switch (input.ToLower()) { case "a": _wishlistDictionary.Add(_wishlistDictionary.Count + 1, AddWishlist()); _wishlistMenu = new WishlistMenu(_wishlistDictionary.Last().Value); _wishlistMenu.ShowWishlistMenu(); break; case "e": _jsonReadWriter.SaveWishlistToFile(_wishlistDictionary); Environment.Exit(0); break; default: if (Regex.IsMatch(input, @"^[0-9]+$")) { _wishlistMenu = new WishlistMenu(_wishlistDictionary[int.Parse(input)]); _wishlistMenu.ShowWishlistMenu(); break; } else { Console.WriteLine("Input is not a number or valid option."); break; } } } }