public static void ShowIntefaceSolution() { MainMenu mainMenu = new MainMenu("Interface Solution: "); MenuItem versionAndSpacesItem = new MenuItem("Version And Spaces"); MenuItem showDateAndTimeItem = new MenuItem("Show Date / Time"); mainMenu.AddSubMenu(versionAndSpacesItem); mainMenu.AddSubMenu(showDateAndTimeItem); ExecuteMethodItem countSpacesItem = new ExecuteMethodItem("Count Spaces"); countSpacesItem.Executable = new CountSpaces(); versionAndSpacesItem.AddSubMenu(countSpacesItem); ExecuteMethodItem versionItem = new ExecuteMethodItem("Show Version"); versionItem.Executable = new Version(); versionAndSpacesItem.AddSubMenu(versionItem); ExecuteMethodItem showDateItem = new ExecuteMethodItem("Show Date"); showDateItem.Executable = new Date(); showDateAndTimeItem.AddSubMenu(showDateItem); ExecuteMethodItem showTimeItem = new ExecuteMethodItem("Show Time"); showTimeItem.Executable = new Time(); showDateAndTimeItem.AddSubMenu(showTimeItem); mainMenu.Show(); }
public static void ShowDelegateSolution() { MenuItem mainMenu = new MainMenu("Delegate version:"); MenuItem VersionAndSpacesMenu = new MenuItem("Version and Spaces"); mainMenu.AddSubMenu(VersionAndSpacesMenu); ExecuteMethodItem countSpacesItem = new ExecuteMethodItem("Count Spaces"); countSpacesItem.m_ExectuteSelectedItem += new CountSpaces().PrintNumOfSpaces; ExecuteMethodItem showVersionItem = new ExecuteMethodItem("Show Version"); showVersionItem.m_ExectuteSelectedItem += new Version().PrintVersion; VersionAndSpacesMenu.AddSubMenu(countSpacesItem); VersionAndSpacesMenu.AddSubMenu(showVersionItem); MenuItem showDateAndTimeMenu = new MenuItem("Show Date/Time"); mainMenu.AddSubMenu(showDateAndTimeMenu); ExecuteMethodItem ShowDateItem = new ExecuteMethodItem("Show Date"); ShowDateItem.m_ExectuteSelectedItem += new Date().PrintDateOfToday; showDateAndTimeMenu.AddSubMenu(ShowDateItem); ExecuteMethodItem showTimeItem = new ExecuteMethodItem("Show Time"); showTimeItem.m_ExectuteSelectedItem += new Time().PrintTheTime; showDateAndTimeMenu.AddSubMenu(showTimeItem); mainMenu.Show(); }