Exemplo n.º 1
0
        public void Run()
        {
            var recipeTypes = RecipeLoader.GetRecipeTypes();

            if (!recipeTypes.Any())
            {
                Console.WriteLine("No recipes have been added to the project");
                return;
            }

            Console.WriteLine("Choose a recipe:");

            int choosenRecipe = 0;

            while (choosenRecipe == 0)
            {
                for (int i = 1; i <= recipeTypes.Count; i++)
                {
                    var recipeType = recipeTypes[i - 1];
                    Console.WriteLine(i + ". " + recipeType.Name);
                }
                if (!int.TryParse(Console.ReadLine(), out choosenRecipe))
                {
                    choosenRecipe = 0;
                }
            }

            var choosenRecipeType = recipeTypes[choosenRecipe - 1];

            RecipeLoader.RunRecipe(choosenRecipeType.Type, new NullLogger());
        }
        protected override void OnLoad(EventArgs e)
        {
            var recipeTypes = RecipeLoader.GetRecipeTypes();

            listBox1.DataSource    = recipeTypes;
            listBox1.DisplayMember = "Name";
        }