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();
        }
Beispiel #2
0
        internal static void InterFaceMenu(Interfaces.MainMenu i_Menu)
        {
            Interfaces.MenuItem digitAndVersion = new Interfaces.MenuItem("Version and Digits", 1);
            i_Menu.AddToMainMenu(digitAndVersion);

            CountCapital count = new CountCapital();

            Interfaces.MenuItem countCapital = new Interfaces.MenuItem("Count Capital", 1, count);
            digitAndVersion.AddToSubMenu(countCapital);

            ShowVersion version = new ShowVersion();

            Interfaces.MenuItem showVersion = new Interfaces.MenuItem("Show Version", 2, version);
            digitAndVersion.AddToSubMenu(showVersion);

            Interfaces.MenuItem dateAndTime = new Interfaces.MenuItem("Show Date/Time", 2);
            i_Menu.AddToMainMenu(dateAndTime);

            ShowTime time = new ShowTime();

            Interfaces.MenuItem showTime = new Interfaces.MenuItem("Show Time", 1, time);
            dateAndTime.AddToSubMenu(showTime);

            ShowDate date = new ShowDate();

            Interfaces.MenuItem showDate = new Interfaces.MenuItem("Show Date", 2, date);
            dateAndTime.AddToSubMenu(showDate);

            i_Menu.Show();
        }
Beispiel #3
0
        public InterfaceTest()
        {
            ShowDate    showDateObject       = new ShowDate();
            ShowTime    showTimeObject       = new ShowTime();
            ShowVersion showVersionObject    = new ShowVersion();
            CountDigits countDigitsObject    = new CountDigits();
            Inner       showDateTimeItem     = new Inner(@"Show Date/Time", m_MainMenu.CurrentItem);
            Leaf        ShowDateItem         = new Leaf("Show Date", showDateTimeItem, showDateObject as IClickObserver);
            Leaf        ShowTimeItem         = new Leaf("Show Time", showDateTimeItem, showTimeObject as IClickObserver);
            Inner       VersionAndDigitsItem = new Inner("Version and Digits", m_MainMenu.CurrentItem);
            Leaf        CountDigitsItem      = new Leaf("Count Digits", VersionAndDigitsItem, countDigitsObject as IClickObserver);
            Leaf        ShowVersionItem      = new Leaf("Show Version", VersionAndDigitsItem, showVersionObject as IClickObserver);

            m_MainMenu.AddItem(showDateTimeItem);
            m_MainMenu.AddItem(ShowDateItem);
            m_MainMenu.AddItem(ShowTimeItem);
            m_MainMenu.AddItem(VersionAndDigitsItem);
            m_MainMenu.AddItem(CountDigitsItem);
            m_MainMenu.AddItem(ShowVersionItem);
        }
Beispiel #4
0
        public void Run()
        {
            Menu          versionAndCapitalsMenu = new Menu("Version and Capitals", m_MainMenu.Menu.Level + 1);
            Menu          showDateAndTime        = new Menu("Show date/time", m_MainMenu.Menu.Level + 1);
            ShowDate      showDate      = new ShowDate("Show Date");
            ShowTime      showTime      = new ShowTime("Show Time");
            ShowVersion   showVersion   = new ShowVersion("Show Version");
            CountCapitals countCapitals = new CountCapitals("Count Capitals");

            m_MainMenu.Add(showDateAndTime);
            m_MainMenu.Add(versionAndCapitalsMenu);
            showDateAndTime.Add(showDate);
            showDateAndTime.Add(showTime);
            versionAndCapitalsMenu.Add(showVersion);
            versionAndCapitalsMenu.Add(countCapitals);
            try
            {
                m_MainMenu.Show();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        private void showVersion(Delegates.ExecutableItem i_ItemInMenuSender)
        {
            ShowVersion version = new ShowVersion();

            version.PrintVersion();
        }