Example #1
0
        public static void runDelegatesTest()
        {
            SystemFunctionality allFunctionality = new SystemFunctionality();

            Delegates.Menu        mainMenu           = new Delegates.Menu("main");
            Delegates.SubMenu     timeAndDate        = new Delegates.SubMenu("show Time/Date", mainMenu);
            Delegates.SubMenu     versionAndCapitals = new Delegates.SubMenu("version and capitals", mainMenu);
            Delegates.FinalButton showTime           = new Delegates.FinalButton("show time", timeAndDate);
            showTime.OptionSelectedEventHandler += allFunctionality.showTime;

            Delegates.FinalButton showDate = new Delegates.FinalButton("show Date", timeAndDate);
            showDate.OptionSelectedEventHandler += allFunctionality.showDate;

            Delegates.FinalButton CapitalLettersCount = new Delegates.FinalButton("Count capitals", versionAndCapitals);
            CapitalLettersCount.OptionSelectedEventHandler += allFunctionality.CapitalLettersProcess;

            Delegates.FinalButton showVersion = new Delegates.FinalButton("show version", versionAndCapitals);
            showVersion.OptionSelectedEventHandler += allFunctionality.ShowVersion;

            mainMenu.AddMenuButton(timeAndDate);
            mainMenu.AddMenuButton(versionAndCapitals);

            timeAndDate.AddMenuButton(showTime);
            timeAndDate.AddMenuButton(showDate);

            versionAndCapitals.AddMenuButton(CapitalLettersCount);
            versionAndCapitals.AddMenuButton(showVersion);

            mainMenu.ShowMenu();
        }
 private static void showDelegateMenu()
 {
     Delegates.MainMenu mainMenu     = new Delegates.MainMenu();
     Delegates.Menu     dateTimeMenu = mainMenu.AddMenu("Show Date/Time");
     dateTimeMenu.AddItem("Show Time", new TimeAction().ExecuteItem);
     dateTimeMenu.AddItem("Show Date", new DateAction().ExecuteItem);
     Delegates.Menu versionAndDigits = mainMenu.AddMenu("Version and Digits");
     versionAndDigits.AddItem("Count Digits", new CountDigitsAction().ExecuteItem);
     versionAndDigits.AddItem("Show Version", new VersionAction().ExecuteItem);
     mainMenu.Show();
 }
Example #3
0
        private static void runDelegateMenu()
        {
            Delegates.Menu    mainMenu = new Delegates.Menu("Main Menu");
            MethodsCollection methodsCollectionItem = new MethodsCollection();

            Delegates.Menu versionsAndDigits = mainMenu.MakeSubMenu("Versions and Digits");
            Delegates.Menu showDateOrTime    = mainMenu.MakeSubMenu("Show Date/Time");

            versionsAndDigits.MakeActivator("Count Capitals", methodsCollectionItem.CountCapitals);
            versionsAndDigits.MakeActivator("Show Version", methodsCollectionItem.ShowVersion);
            showDateOrTime.MakeActivator("Show Time", methodsCollectionItem.ShowTime);
            showDateOrTime.MakeActivator("Show Date", methodsCollectionItem.ShowDate);
            mainMenu.Show();
        }
        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();
        }
Example #5
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();
        }