Exemple #1
0
        /// <summary>
        /// Run starts the menu loop
        /// </summary>
        public override void Run()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine(this.Title);
                Console.WriteLine(new string('=', this.Title.Length));
                Vendo_Matic_800.DisplayInventory();
                Console.WriteLine(new string('=', this.Title.Length));
                foreach (KeyValuePair <string, string> menuItem in menuOptions)
                {
                    Console.WriteLine($"({menuItem.Key}) - {menuItem.Value}");
                }

                string choice = GetString("Selection:").ToUpper();

                if (menuOptions.ContainsKey(choice))
                {
                    if (!ExecuteSelection(choice))
                    {
                        //Console.WriteLine("Please choose (1) or (M)!");
                        //Pause("Press [ENTER] to continue.");
                        break;
                    }
                }
                else
                {
                    Pause("Select [1] or [M],");
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Run starts the menu loop
        /// </summary>
        public override void Run()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine(this.Title);
                Console.WriteLine(new string('=', this.Title.Length));
                Vendo_Matic_800.DisplayInventory();
                Console.WriteLine(new string('=', this.Title.Length));
                foreach (KeyValuePair <string, string> menuItem in menuOptions)
                {
                    Console.WriteLine($"({menuItem.Key}) - {menuItem.Value}");
                }

                Console.WriteLine(new string('=', this.Title.Length));
                Console.WriteLine($"Current Funds Available: {Vendo_Matic_800.Balance:C}");
                Console.WriteLine(new string('=', this.Title.Length));

                string choice = GetString("Selection:");

                if ((!menuOptions.ContainsKey(choice)) && (!Vendo_Matic_800.vendingStock.ContainsKey(choice)))
                {
                    Pause("Invalid Input,");
                }
                else if (!ExecuteSelection(choice))
                {
                    break;
                }
            }
        }