示例#1
0
        static void Main(string[] args)
        {
            var mainMenu = new CMenu(MenuType.Numbers)
            {
                new MenuEntry("Create/Update the clients", CreateOrUpdateTheClients),
                new MenuEntry("Create/Update api resources", CreateOrUpdateTheApiResources),
                new MenuEntry("Create/Update identity resources", CreateOrUpdateTheIdentityResources),
                new MenuEntry("Create/Update persisted grants", CreateOrUpdateThePersistedGrants),
            };

            var exit = false;

            while (!exit)
            {
                Console.WriteLine("Please select your action: ");
                mainMenu.PrintMenu('.', '\t');
                Console.WriteLine("Type quit to exit: ");

                var input = Console.ReadLine();

                int menuIndex;
                if (!int.TryParse(input, out menuIndex))
                {
                    exit = input.Contains("quit");
                }

                if (menuIndex > 0 && !mainMenu.ExecuteEntry(menuIndex))
                {
                    Console.WriteLine("Selection not allowed!");
                }
            }

            Console.ReadKey();
        }