public static void RunDelegatesSolution() { Ex02.ConsoleUtils.Screen.Clear(); Console.WriteLine("Delegates solution..."); string chooseOptionMessege = "Please, choose one of the options"; Ex04.Menus.Delegates.MainMenu mainMenu = new Ex04.Menus.Delegates.MainMenu("Main menu", chooseOptionMessege); Ex04.Menus.Delegates.MainMenu showDateORTimeMenu = new Ex04.Menus.Delegates.MainMenu("Show Date/Time", chooseOptionMessege); mainMenu.addOption(showDateORTimeMenu); Ex04.Menus.Delegates.ExecutableOperation wordCounterOption = new Ex04.Menus.Delegates.ExecutableOperation(new Ex04.Menus.Delegates.Operation(Ex04.Menus.Delegates.Operations.WordsCounterOperation), "Words Counter"); mainMenu.addOption(wordCounterOption); Ex04.Menus.Delegates.ExecutableOperation showVersionOption = new Ex04.Menus.Delegates.ExecutableOperation(new Ex04.Menus.Delegates.Operation(Ex04.Menus.Delegates.Operations.ShowVersionOperation), "Show Version"); mainMenu.addOption(showVersionOption); Ex04.Menus.Delegates.ExecutableOperation showTimeOption = new Ex04.Menus.Delegates.ExecutableOperation(new Ex04.Menus.Delegates.Operation(Ex04.Menus.Delegates.Operations.ShowTimeOperation), "Show Time"); showDateORTimeMenu.addOption(showTimeOption); Ex04.Menus.Delegates.ExecutableOperation showDateOption = new Ex04.Menus.Delegates.ExecutableOperation(new Ex04.Menus.Delegates.Operation(Ex04.Menus.Delegates.Operations.ShowDateOperation), "Show Date"); showDateORTimeMenu.addOption(showDateOption); showDateORTimeMenu.setPreviousMenu(new Ex04.Menus.Delegates.ShowMenu(mainMenu.Show)); mainMenu.Show(); }
private static void runDelegateMenu() { const bool v_IsMainMenu = false; MethodsForMenusDelegates methodsForMenusDelegates = new MethodsForMenusDelegates(); MenuDelegates.MainMenu mainMenuDelegates = new MenuDelegates.MainMenu("Delegates Main Menu"); MenuDelegates.SubMenu subMenuDateAndTimeDelegate = new MenuDelegates.SubMenu("Show Date/Time", v_IsMainMenu); MenuDelegates.SubMenu subMenuVersionAndDigitsDelegate = new MenuDelegates.SubMenu("Version and Digits", v_IsMainMenu); MenuDelegates.MenuItemExecutable showDateDelegate = new MenuDelegates.MenuItemExecutable("Show Date"); showDateDelegate.MenuItemClicked += methodsForMenusDelegates.ShowDate; MenuDelegates.MenuItemExecutable showTimeDelegate = new MenuDelegates.MenuItemExecutable("Show Time"); showTimeDelegate.MenuItemClicked += methodsForMenusDelegates.ShowTime; MenuDelegates.MenuItemExecutable countDigitsDelegate = new MenuDelegates.MenuItemExecutable("Count Digits"); countDigitsDelegate.MenuItemClicked += methodsForMenusDelegates.CountDigits; MenuDelegates.MenuItemExecutable showVersionDelegate = new MenuDelegates.MenuItemExecutable("Show Version"); showVersionDelegate.MenuItemClicked += methodsForMenusDelegates.ShowVersion; subMenuDateAndTimeDelegate.AddItemToSubMenu(showDateDelegate); subMenuDateAndTimeDelegate.AddItemToSubMenu(showTimeDelegate); subMenuVersionAndDigitsDelegate.AddItemToSubMenu(countDigitsDelegate); subMenuVersionAndDigitsDelegate.AddItemToSubMenu(showVersionDelegate); mainMenuDelegates.AddMenuItemToMainMenu(subMenuDateAndTimeDelegate); mainMenuDelegates.AddMenuItemToMainMenu(subMenuVersionAndDigitsDelegate); mainMenuDelegates.Show(); }
public static void InitializeUserMenus() { Interfaces.MainMenu interfaceMenu = createInterfaceMenu(); interfaceMenu.Show(); Delegates.MainMenu delegateMenu = createDelegateMenu(); delegateMenu.Show(); }
private static Delegates.MainMenu createDelegateMenu() { List <Delegates.MenuItem> showDateAndTime = new List <Delegates.MenuItem>(); Delegates.MenuItem showTime = new Delegates.LeafItem("Show Time", new MenuActions.ShowDateTimeData("HH:mm:ss").ExecuteAction); Delegates.MenuItem showDate = new Delegates.LeafItem("Show Date", new MenuActions.ShowDateTimeData("dd-MM-yyyy").ExecuteAction); showDateAndTime.Add(showTime); showDateAndTime.Add(showDate); List <Delegates.MenuItem> showVersionAndDigits = new List <Delegates.MenuItem>(); Delegates.MenuItem countDigits = new Delegates.LeafItem("Count Digits", new MenuActions.CountDigits().ExecuteAction); Delegates.MenuItem showVersion = new Delegates.LeafItem("Show Version", new MenuActions.ShowVersion().ExecuteAction); showVersionAndDigits.Add(countDigits); showVersionAndDigits.Add(showVersion); Delegates.MenuItem showDateAndTimeItem = new Delegates.NodeItem("Show Date/Time", showDateAndTime); Delegates.MenuItem showVersionAndDigitsItem = new Delegates.NodeItem("Version and Digits", showVersionAndDigits); List <Delegates.MenuItem> delgateMenuItems = new List <Delegates.MenuItem>(); Delegates.MainMenu delegateMenu = new Delegates.MainMenu("Delegate Menu", delgateMenuItems); delegateMenu.AddItemToMenu(showDateAndTimeItem); delegateMenu.AddItemToMenu(showVersionAndDigitsItem); return(delegateMenu); }
public SubMenu(string i_Title, SubMenu i_PreviousMenu) : base(i_Title) { m_MainMenu = new MainMenu(i_Title); m_MainMenu.ChangeExitName(eBackType.Back.ToString()); }