Ejemplo n.º 1
0
        public static void RunInterfacesSolution()
        {
            string chooseOptionMessege = "Please, choose one of the options";

            Ex04.Menus.Interfaces.MainMenu mainMenu = new Ex04.Menus.Interfaces.MainMenu("Main menu", chooseOptionMessege);

            Ex04.Menus.Interfaces.MainMenu showDateORTimeMenu = new Ex04.Menus.Interfaces.MainMenu("Show Date/Time", chooseOptionMessege);
            mainMenu.addOption(showDateORTimeMenu);

            Ex04.Menus.Interfaces.ExecutableOperation wordCounterOption = new Ex04.Menus.Interfaces.WordsCounterOperation("Words Counter");
            mainMenu.addOption(wordCounterOption);

            Ex04.Menus.Interfaces.ExecutableOperation showVersionOption = new Ex04.Menus.Interfaces.ShowVersionOperation("Show Version");
            mainMenu.addOption(showVersionOption);

            Ex04.Menus.Interfaces.ExecutableOperation showTimeOption = new Ex04.Menus.Interfaces.ShowTimeOperation("Show Time");
            showDateORTimeMenu.addOption(showTimeOption);

            Ex04.Menus.Interfaces.ExecutableOperation showDateOption = new Ex04.Menus.Interfaces.ShowDateOperation("Show Date");
            showDateORTimeMenu.addOption(showDateOption);

            showDateORTimeMenu.setPreviousMenu(mainMenu);

            mainMenu.Show();
        }
Ejemplo n.º 2
0
        private static void runInterfaceMenu()
        {
            const bool v_IsMainMenu = false;

            MenuInterfaces.MainMenu mainMenuInterfaces = new MenuInterfaces.MainMenu("Interfaces Main Menu");

            MenuInterfaces.SubMenu subMenuDateAndTimeInterface      = new MenuInterfaces.SubMenu("Show Date/Time", v_IsMainMenu);
            MenuInterfaces.SubMenu subMenuVersionAndDigitsInterface = new MenuInterfaces.SubMenu("Version and Digits", v_IsMainMenu);

            MenuInterfaces.MenuItemExecutable showDateInterface = new MenuInterfaces.MenuItemExecutable("Show Date");
            showDateInterface.AddListener(new ShowDate() as MenuInterfaces.IMenuClickListener);
            MenuInterfaces.MenuItemExecutable showTimeInterface = new MenuInterfaces.MenuItemExecutable("Show Time");
            showTimeInterface.AddListener(new ShowTime() as MenuInterfaces.IMenuClickListener);
            MenuInterfaces.MenuItemExecutable countDigitsInterface = new MenuInterfaces.MenuItemExecutable("Count Digits");
            countDigitsInterface.AddListener(new CountDigits() as MenuInterfaces.IMenuClickListener);
            MenuInterfaces.MenuItemExecutable showVersionInterface = new MenuInterfaces.MenuItemExecutable("Show Version");
            showVersionInterface.AddListener(new ShowVersion() as MenuInterfaces.IMenuClickListener);

            subMenuDateAndTimeInterface.AddItemToSubMenu(showDateInterface);
            subMenuDateAndTimeInterface.AddItemToSubMenu(showTimeInterface);
            subMenuVersionAndDigitsInterface.AddItemToSubMenu(countDigitsInterface);
            subMenuVersionAndDigitsInterface.AddItemToSubMenu(showVersionInterface);

            mainMenuInterfaces.AddMenuItemToMainMenu(subMenuDateAndTimeInterface);
            mainMenuInterfaces.AddMenuItemToMainMenu(subMenuVersionAndDigitsInterface);
            mainMenuInterfaces.Show();
        }
Ejemplo n.º 3
0
 public static void InitializeUserMenus()
 {
     Interfaces.MainMenu interfaceMenu = createInterfaceMenu();
     interfaceMenu.Show();
     Delegates.MainMenu delegateMenu = createDelegateMenu();
     delegateMenu.Show();
 }
        public static void InterfaceMenu()
        {
            Ex04.Menus.Interfaces.MainMenu menu  = new Ex04.Menus.Interfaces.MainMenu();
            Ex04.Menus.Interfaces.MenuItem main  = menu.AddMenuItem("The main menu");
            Ex04.Menus.Interfaces.MenuItem item1 = menu.AddMenuItem(main, "Vision and spaces");
            Ex04.Menus.Interfaces.MenuItem item2 = menu.AddMenuItem(main, "Show Date/Time");
            Menus actionPerformer = new Menus();

            Ex04.Menus.Interfaces.ActionItem numOfSpaces = menu.AddActionItem(item1, "Count spaces", actionPerformer);
            Ex04.Menus.Interfaces.ActionItem showVersion = menu.AddActionItem(item1, "Show version", actionPerformer);
            Ex04.Menus.Interfaces.ActionItem dateToday   = menu.AddActionItem(item2, "Show date", actionPerformer);
            Ex04.Menus.Interfaces.ActionItem timeNow     = menu.AddActionItem(item2, "Show time", actionPerformer);

            menu.Show();
        }
Ejemplo n.º 5
0
        private static Interfaces.MainMenu createInterfaceMenu()
        {
            List <Interfaces.MenuItem> showDateAndTime = new List <Interfaces.MenuItem>();

            Interfaces.MenuItem showTime = new Interfaces.LeafItem("Show Time", new MenuActions.ShowDateTimeData("HH:mm:ss"));
            Interfaces.MenuItem showDate = new Interfaces.LeafItem("Show Date", new MenuActions.ShowDateTimeData("dd-MM-yyyy"));
            showDateAndTime.Add(showTime);
            showDateAndTime.Add(showDate);
            List <Interfaces.MenuItem> showVersionAndDigits = new List <Interfaces.MenuItem>();

            Interfaces.MenuItem countDigits = new Interfaces.LeafItem("Count Digits", new MenuActions.CountDigits());
            Interfaces.MenuItem showVersion = new Interfaces.LeafItem("Show Version", new MenuActions.ShowVersion());
            showVersionAndDigits.Add(countDigits);
            showVersionAndDigits.Add(showVersion);
            Interfaces.MenuItem        showDateAndTimeItem      = new Interfaces.NodeItem("Show Date/Time", showDateAndTime);
            Interfaces.MenuItem        showVersionAndDigitsItem = new Interfaces.NodeItem("Version and Digits", showVersionAndDigits);
            List <Interfaces.MenuItem> interfaceMenuItems       = new List <Interfaces.MenuItem>();

            Interfaces.MainMenu interfaceMenu = new Interfaces.MainMenu("Interface Menu", interfaceMenuItems);
            interfaceMenu.AddItemToMenu(showDateAndTimeItem);
            interfaceMenu.AddItemToMenu(showVersionAndDigitsItem);

            return(interfaceMenu);
        }