public static void Run() { m_DelegateMainMenu = new Delegates.MainMenu("Delegate Main Menu Title!"); Delegates.SubMenu firstSubMenu = new Delegates.SubMenu("Version and Capitals"); Delegates.SubMenu secondSubMenu = new Delegates.SubMenu("Show Date/Time"); Delegates.ActionNode countCapitals = new Delegates.ActionNode("Count Capitals", new Methods.CountCapitals().Execute); Delegates.ActionNode showVersion = new Delegates.ActionNode("Show Version", new Methods.ShowVersion().Execute); Delegates.ActionNode showTime = new Delegates.ActionNode("Show time", new Methods.ShowTime().Execute); Delegates.ActionNode showDate = new Delegates.ActionNode("Show Date", new Methods.ShowDate().Execute); // Build main menu m_DelegateMainMenu.ListOfMenuNodes.AddMenuNode(firstSubMenu); m_DelegateMainMenu.ListOfMenuNodes.AddMenuNode(secondSubMenu); // Build version and capitals firstSubMenu.AddMenuNode(countCapitals); firstSubMenu.AddMenuNode(showVersion); // Build show and date secondSubMenu.AddMenuNode(showTime); secondSubMenu.AddMenuNode(showDate); m_DelegateMainMenu.Show(); }
internal static void DelegateMenu(Delegates.MainMenu i_Menu) { Delegates.MenuItem versionAndDigit = new Delegates.MenuItem("Version and Digits"); i_Menu.AddToMainMenu(versionAndDigit); Delegates.MenuItem countCapital = new Delegates.MenuItem("Count Capital"); countCapital.m_Action += CountCapitalAction; versionAndDigit.AddToSubMenu(countCapital); Delegates.MenuItem showVersion = new Delegates.MenuItem("Show Version"); showVersion.m_Action += ShowVersionAction; versionAndDigit.AddToSubMenu(showVersion); Delegates.MenuItem dateAndTime = new Delegates.MenuItem("Show Date/Time"); i_Menu.AddToMainMenu(dateAndTime); Delegates.MenuItem showTime = new Delegates.MenuItem("Show Time"); showTime.m_Action += ShowTimeAction; dateAndTime.AddToSubMenu(showTime); Delegates.MenuItem showDate = new Delegates.MenuItem("Show Date"); showDate.m_Action += ShowDateAction; dateAndTime.AddToSubMenu(showDate); i_Menu.Show(); }
private static void startMenus() { Interfaces.MainMenu mainMenuInterfaces = createInterfacesMainMenu(); Delegates.MainMenu mainMenuDelegates = createDelegateMainMenu(); mainMenuInterfaces.Show(); mainMenuDelegates.Show(); }
public static void Main() { Interfaces.MainMenu interfaceMenu = buildMainMenuInterface(); Delegates.MainMenu delegateMenu = buildMainMenuDelegates(); interfaceMenu.Show(); delegateMenu.Show(); }
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(); }
public static void Main() { Interfaces.MainMenu interfaceMainMenu = InitializeMenu.CreateInterfaceMenu(); interfaceMainMenu.Show(); Delegates.MainMenu DelegateMainMenu = InitializeMenu.CreateDelegatesMenu(); DelegateMainMenu.Show(); }
public static void Main(string[] args) { BuildMenuDelegate("Delegate"); m_MainMenuDelegate.Show(); BuildMenuInterface("Interface"); m_MainMenuInterface.Show(); }
public static void Main() { Interfaces.MainMenu firstTest = new Interfaces.MainMenu(); Delegates.MainMenu secondTest = new Delegates.MainMenu(); firstTest.Show(); secondTest.Show(); }
public static void Main() { Interfaces.MainMenu mainMenuInterface = new Interfaces.MainMenu(InterfaceProgramUtils.MainMenuCreator()); mainMenuInterface.Show(); Delegates.MainMenu mainMenu = MainMenuDelegatesBuilder.Build(); mainMenu.Show(); }
public static void Main() { Interfaces.MainMenu InterfaceMenu = Menus.CreateMainMenuInterfaces(); InterfaceMenu.Show(); Delegates.MainMenu DelegateMenu = Menus.CreateMainMenuDelegate(); DelegateMenu.Show(); }
public void ShowMenu() { try { r_MainMenu.Show(); } catch (Exception ex) { throw ex; } }
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(); }
public static void Main() { Interfaces.MainMenu mainMenuInterfaces = CreateMenuWithInterfaces(); mainMenuInterfaces.Show(); Console.WriteLine("Switch to menu builder with delegates"); Thread.Sleep(800); Console.Clear(); Delegates.MainMenu mainMenuDelegates = CreateMenuWithDelegates(); mainMenuDelegates.Show(); }
internal void Run() { Console.Title = "Menus"; Console.ForegroundColor = ConsoleColor.White; Console.BackgroundColor = ConsoleColor.Black; InterfaceMainMenu interfaceMainMenu = InitInterfaceMainMenu(); DelegateMainMenu delegateMainMenu = InitDelegateMainMenu(); interfaceMainMenu.Show(); delegateMainMenu.Show(); }
private static void runDelegateImplementaion() { //Menu Item 1 Delegates.SubMenuItem actionsAndInfo = new Delegates.SubMenuItem("Actions and Info"); //Menu Item 1.1 FunctionMenuItem displayVersion = new FunctionMenuItem("Display Version"); displayVersion.m_ExecuteFunction += DisplayVersion.Display; actionsAndInfo.AddMenuItem(displayVersion); //Menu Item 1.2 Delegates.SubMenuItem actions = new Delegates.SubMenuItem("Actions"); //Menu Item 1.2.1 FunctionMenuItem spaceCounter = new FunctionMenuItem("Count Spaces"); spaceCounter.m_ExecuteFunction += SpaceCounter.Count; actions.AddMenuItem(spaceCounter); //Menu Item 1.2.2 FunctionMenuItem charsCounter = new FunctionMenuItem("Chars Count"); charsCounter.m_ExecuteFunction += CharsCounter.Count; actions.AddMenuItem(charsCounter); actionsAndInfo.AddMenuItem(actions); //Menu Item 2 Delegates.SubMenuItem dateAndTime = new Delegates.SubMenuItem("Show Date/Time"); //Menu Item 2.1 FunctionMenuItem showTime = new FunctionMenuItem("Show Time"); showTime.m_ExecuteFunction += DisplayTime.Display; dateAndTime.AddMenuItem(showTime); //Menu Item 2.2 FunctionMenuItem showDate = new FunctionMenuItem("Show Date"); showDate.m_ExecuteFunction += DisplayDate.Display; dateAndTime.AddMenuItem(showDate); /* Prepare main menu */ Delegates.SubMenuItem mainMenu = new Delegates.SubMenuItem("Main Menu - Delegates Implemented"); mainMenu.AddMenuItem(actionsAndInfo); mainMenu.AddMenuItem(dateAndTime); Delegates.MainMenu interfaceMainMenu = new Delegates.MainMenu(mainMenu); /* execute */ interfaceMainMenu.Show(); }
private static void delegateMenu() { Delegates.MainMenu mainMenuDelegates = new Delegates.MainMenu("Main Menu"); DelegatesTest dateAndTimeDelegates = new DelegatesTest(); int showDateTimeHashCode = mainMenuDelegates.AddNewMenuItemUnder(mainMenuDelegates.RootHashCode, "Show Date/Time"); int showVersionAndDigits = mainMenuDelegates.AddNewMenuItemUnder(mainMenuDelegates.RootHashCode, "Version and Digits"); mainMenuDelegates.AddNewOperationItemUnder(showDateTimeHashCode, "Show Date", dateAndTimeDelegates.ShowDate_Click); mainMenuDelegates.AddNewOperationItemUnder(showDateTimeHashCode, "Show Time", dateAndTimeDelegates.ShowTime_Click); mainMenuDelegates.AddNewOperationItemUnder(showVersionAndDigits, "Count Digits", dateAndTimeDelegates.CountDigits_Click); mainMenuDelegates.AddNewOperationItemUnder(showVersionAndDigits, "Show Version", dateAndTimeDelegates.ShowVersion_Click); mainMenuDelegates.Show(); }
public static void Main() { List <Interfaces.MenuItem> menuItemsWithInterfaces = InterfacesMenuCreator.BuildMenuItemsWithInterfaces(); Interfaces.MainMenu mainMenuWithInterfaces = new Interfaces.MainMenu(); mainMenuWithInterfaces.Build(menuItemsWithInterfaces); mainMenuWithInterfaces.Title = "Main Menu With Interfaces!"; mainMenuWithInterfaces.Show(); List <Delegates.MenuItem> menuItemsWithDelegates = DelegatesMenuCreator.BuildMenuItemsWithDelegates(); Delegates.MainMenu mainMenuWithDelegates = new Delegates.MainMenu(); mainMenuWithDelegates.Build(menuItemsWithDelegates); mainMenuWithDelegates.Title = "Main Menu With Delegates!"; mainMenuWithDelegates.Show(); }
public void ExecuteDelegatesBasedMenu() { Delegates.MainMenu mainMenu = new Delegates.MainMenu("Delegates Based Menu"); mainMenu.AddAnotherSubMenu(new Delegates.MenuItem("Show Date/Time")); // Menu location on List is 0 in mainmenu mainMenu.AddAnotherSubMenu(new Delegates.MenuItem("Version and Digits")); // Menu location on List is 1 in mainmenu // Date and time Insertion Delegates.MenuItem ShowDateAndTimeMenu = mainMenu.GetSubMenuByIndex(0); ShowDateAndTimeMenu.AddAnotherSubMenu(new Delegates.ActionMenu(new Date().PreformAction, "Show Date")); ShowDateAndTimeMenu.AddAnotherSubMenu(new Delegates.ActionMenu(new Time().PreformAction, "Show Time")); // Version and Digits Insertion Delegates.MenuItem ShowVersionAndDigits = mainMenu.GetSubMenuByIndex(1); ShowVersionAndDigits.AddAnotherSubMenu(new Delegates.ActionMenu(new Version().PreformAction, "Show Version")); ShowVersionAndDigits.AddAnotherSubMenu(new Delegates.ActionMenu(new Digits().PreformAction, "Count Spaces")); mainMenu.Show(); }
private static void RunDelegateMenu() { Delegates.MasterItem mainMenuDelegate = new Delegates.MasterItem("Main Menu - Delegate"); Delegates.MainMenu delegatesMainMenu = new Delegates.MainMenu(mainMenuDelegate); Delegates.MasterItem timeMenuDelegate = new Delegates.MasterItem("Time Menu"); Delegates.LeafItem wordsCounterItemDelegate = new Delegates.LeafItem("Words Counter"); Delegates.LeafItem showVersionItemDelegate = new Delegates.LeafItem("Show Version"); Delegates.LeafItem showTimeItemDelegate = new Delegates.LeafItem("Show Time"); Delegates.LeafItem showDateItemDelegate = new Delegates.LeafItem("Show Date"); wordsCounterItemDelegate.DoAction += WordsCounterMethod; showVersionItemDelegate.DoAction += ShowVersionMethod; showTimeItemDelegate.DoAction += ShowTimeMethod; showDateItemDelegate.DoAction += ShowDateMethod; timeMenuDelegate.AddItem(showTimeItemDelegate); timeMenuDelegate.AddItem(showDateItemDelegate); mainMenuDelegate.AddItem(timeMenuDelegate); mainMenuDelegate.AddItem(wordsCounterItemDelegate); mainMenuDelegate.AddItem(showVersionItemDelegate); delegatesMainMenu.Show(); }
public static void runDelegates() { Delegates.MainMenu MainMenu = new Delegates.MainMenu("Main Menu - Delegates"); Delegates.MenuItem ShowDateOrTime = new Delegates.MenuItem(1, "Show Date/Time"); Delegates.MenuItem VersionAndCapitals = new Delegates.MenuItem(2, "Version And Capitals"); MainMenu.AddMenuItem(ShowDateOrTime); MainMenu.AddMenuItem(VersionAndCapitals); Delegates.MenuItem ShowTime = new Delegates.ActionMenuItem(1, "Show Time"); Delegates.MenuItem ShowDate = new Delegates.ActionMenuItem(2, "Show Date"); Delegates.MenuItem CountCapitals = new Delegates.ActionMenuItem(1, "Count Capitals"); Delegates.MenuItem DisplayVersion = new Delegates.ActionMenuItem(2, "Display Version"); ShowDateOrTime.AddSubItem(ShowTime); ShowDateOrTime.AddSubItem(ShowDate); VersionAndCapitals.AddSubItem(CountCapitals); VersionAndCapitals.AddSubItem(DisplayVersion); ShowDate.AttachObserver(new Delegates.ReportChosenDelegate(ShowCurrentDate)); ShowTime.AttachObserver(new Delegates.ReportChosenDelegate(ShowCurrentTime)); CountCapitals.AttachObserver(new Delegates.ReportChosenDelegate(CountCapitalsMethod)); DisplayVersion.AttachObserver(new Delegates.ReportChosenDelegate(DisplayVersionMethod)); MainMenu.Show(); }
private static void activateDelegateVersion() { Delegates.MenuItem m_VersionsActions = new Delegates.MenuItem("Versions and Actions"); Delegates.MenuItem m_ShowVersion = new Delegates.MenuItem("Show Version"); m_ShowVersion.DoAction += VersionDisplay.ShowVersion; m_VersionsActions.AddMenuItem(m_ShowVersion); Delegates.MenuItem m_ActionsToDo = new Delegates.MenuItem("Actions"); Delegates.MenuItem m_CharacterToCount = new Delegates.MenuItem("Chars Count"); Delegates.MenuItem m_CountingTheSpaces = new Delegates.MenuItem("Count Spaces"); m_CharacterToCount.DoAction += CharsCount.CountChars; m_CountingTheSpaces.DoAction += SpacesCount.CountSpaces; m_ActionsToDo.AddMenuItem(m_CharacterToCount); m_ActionsToDo.AddMenuItem(m_CountingTheSpaces); m_VersionsActions.AddMenuItem(m_ActionsToDo); // Show Time and Date menu Delegates.MenuItem m_ShowDateTime = new Delegates.MenuItem("Show Date/Time"); Delegates.MenuItem m_ShowsTime = new Delegates.MenuItem("Show Time"); Delegates.MenuItem m_ShowsDate = new Delegates.MenuItem("Show Date"); m_ShowsTime.DoAction += TimeDisplay.ShowTime; m_ShowsDate.DoAction += DateDisplay.ShowDate; m_ShowDateTime.AddMenuItem(m_ShowsTime); m_ShowDateTime.AddMenuItem(m_ShowsDate); // Main menu Delegates.MenuItem firstMenuDelegates = new Delegates.MenuItem("My Menu implemented with Delegates"); Delegates.MainMenu mainMenuDelegates = new Delegates.MainMenu(firstMenuDelegates); firstMenuDelegates.AddMenuItem(m_VersionsActions); firstMenuDelegates.AddMenuItem(m_ShowDateTime); mainMenuDelegates.Show(); }
internal static void RunDelegatesMenu(Delegates.MainMenu i_DelegatesMenu) { i_DelegatesMenu.Show(); EndOfMenu(); }
internal void Show() { m_Menu.Show(); }