Beispiel #1
0
        public void ParseAndDestroy(string input)
        {
            if (int.TryParse(input, out int option))
            {

                var list = Options.Where(x => x.Number == option);
                if (list.Count() > 0)
                {
                    MenuOption op = list.First();
                    op.Action.Run();
                }

            }
        }
Beispiel #2
0
        // faz menu
        public Menu()
        {
            Options = new List<MenuOption>();

            MenuOption creator = new MenuOption
            {
                Number = 1,
                DisplayText = string.Format($"{"Cria o Arquivo",-30}"),
                Action = new FazJson()

            };

            MenuOption Exit = new MenuOption
            {
                Number = 0,
                DisplayText = string.Format($"{"Sai do Programa",-30}"),
                Action = new Exit()

            };
            Options.Add(creator);

            Options.Add(Exit);
        }