private static void delegateMenuTest()
        {
            Delegates.MainMenu firstMainMenu = new Delegates.MainMenu("Delegate Main Menu");

            Delegates.Menu dateTimeMenu         = firstMainMenu.AddSubMenuItem("Show Date/Time");
            Delegates.Menu versionAndDigitsMenu = firstMainMenu.AddSubMenuItem("Version and Digits");

            dateTimeMenu.AddActionMenuItem("Show Date", new DateOperation().Operate);
            dateTimeMenu.AddActionMenuItem("Show Time", new TimeOperation().Operate);
            versionAndDigitsMenu.AddActionMenuItem("Count Digits", new CountDigitsOperation().Operate);
            versionAndDigitsMenu.AddActionMenuItem("Show Version", new ShowVersionOperation().Operate);

            firstMainMenu.ShowMenu();
        }
Esempio n. 2
0
        private static void delegateMenuTest()
        {
            Delegates.MainMenu firstMainMenu = new Delegates.MainMenu();

            // First Layer:
            Delegates.Menu dateTimeMenu          = firstMainMenu.AddSubMenuItem("Show Date/Time");
            Delegates.Menu versionAndActionsMenu = firstMainMenu.AddSubMenuItem("Version and Actions");

            // Second Layer:
            dateTimeMenu.AddActionMenuItem("Show Date", new DateOperation().Operate);
            dateTimeMenu.AddActionMenuItem("Show Time", new TimeOperation().Operate);
            Delegates.Menu actionsMenu = versionAndActionsMenu.AddSubMenuItem("Actions");
            versionAndActionsMenu.AddActionMenuItem("Show Version", new ShowVersionOperation().Operate);

            // Third Layer:
            actionsMenu.AddActionMenuItem("Count Spaces", new CountSpacesOperation().Operate);
            actionsMenu.AddActionMenuItem("Count Words", new CountWordsOperation().Operate);

            // Show the menu:
            firstMainMenu.ShowMenu();
        }