// building the main menu using delegates
        private static Delegates.MainMenu buildMainMenuDelegates()
        {
            ExecutableHandler showTimeExecute     = new MenuDelegatesAndInterfaces.ShowTime().Execute;
            ExecutableHandler showDateExcute      = new MenuDelegatesAndInterfaces.ShowDate().Execute;
            ExecutableHandler countCapitalsExcute = new MenuDelegatesAndInterfaces.CountCapitals().Execute;
            ExecutableHandler showVersionExcute   = new MenuDelegatesAndInterfaces.ShowVersion().Execute;

            Delegates.ExecutableItem executableItemShowTime      = new Delegates.ExecutableItem("Show Time", showTimeExecute);
            Delegates.ExecutableItem executableItemShowDate      = new Delegates.ExecutableItem("Show Date", showDateExcute);
            Delegates.ExecutableItem executableItemCountCapitals = new Delegates.ExecutableItem("Count Capitals Letters", countCapitalsExcute);
            Delegates.ExecutableItem executableItemShowVersion   = new Delegates.ExecutableItem("Show Version", showVersionExcute);

            // Creates the sub menus: "Show Date/Time" and "Version and Capitals"
            Delegates.SubMenu showDateAndTimeMenu = new Delegates.SubMenu("Show Date/Time");
            showDateAndTimeMenu.AddItem(executableItemShowTime);
            showDateAndTimeMenu.AddItem(executableItemShowDate);
            Delegates.SubMenu VersionAndCapitalsMenu = new Delegates.SubMenu("Version and Capitals");
            VersionAndCapitalsMenu.AddItem(executableItemCountCapitals);
            VersionAndCapitalsMenu.AddItem(executableItemShowVersion);

            // Creates the Main Menu with both of the sub menus
            Delegates.MainMenu mainMenuDelegate = new Delegates.MainMenu("Main Menu Using Delegate");
            mainMenuDelegate.AddItemToMainMenu(showDateAndTimeMenu);
            mainMenuDelegate.AddItemToMainMenu(VersionAndCapitalsMenu);
            return(mainMenuDelegate);
        }
        private static void DelegateTest()
        {
            Delegates.MainMenu m_MainMenu = new Delegates.MainMenu();

            Delegates.SubMenu      dateTimeMenu = new Delegates.SubMenu("Show Date/Time", m_MainMenu.GetSubMenu());
            Delegates.FunctionItem showTime     = new Delegates.FunctionItem("Show Time");
            ShowTime showTimeInstance           = new ShowTime();

            showTime.AddFunction(new SelectFunctionDelegate(showTimeInstance.Invoke));
            dateTimeMenu.AddItem(showTime);
            Delegates.FunctionItem showDate = new Delegates.FunctionItem("Show Date");
            ShowDate showDateInstance       = new ShowDate();

            showDate.AddFunction(showDateInstance.Invoke);
            dateTimeMenu.AddItem(showDate);

            Delegates.SubMenu      versionAndCapitalsMenu = new Delegates.SubMenu("Version and Capitals", m_MainMenu.GetSubMenu());
            Delegates.FunctionItem countCapitals          = new Delegates.FunctionItem("Count Capitals");
            CountCapitals          countCapitalsInstance  = new CountCapitals();

            countCapitals.AddFunction(countCapitalsInstance.Invoke);
            versionAndCapitalsMenu.AddItem(countCapitals);
            Delegates.FunctionItem showVersion         = new Delegates.FunctionItem("Show Version");
            ShowVersion            showVersionInstance = new ShowVersion();

            showVersion.AddFunction(showVersionInstance.Invoke);
            versionAndCapitalsMenu.AddItem(showVersion);

            m_MainMenu.AddMenuItem(dateTimeMenu);
            m_MainMenu.AddMenuItem(versionAndCapitalsMenu);

            m_MainMenu.Show();
        }