Example #1
0
        public static Interfaces.MainMenu CreateInterfaceMenu()
        {
            Interfaces.MainMenu InterfacesmainMenu = new Interfaces.MainMenu();
            Interfaces.MenuItem subMenu1           = new Interfaces.MenuItem("Show Date/Time");
            Interfaces.MenuItem subMenu2           = new Interfaces.MenuItem("Version and Digits");

            InterfacesmainMenu.AddSubItem(subMenu1);
            InterfacesmainMenu.AddSubItem(subMenu2);

            Interfaces.ActionItem showTimeMethod    = new Interfaces.ActionItem("Show Time", sr_MenuMethods.ShowTime);
            Interfaces.ActionItem showDateMethod    = new Interfaces.ActionItem("Show Date", sr_MenuMethods.ShowDate);
            Interfaces.ActionItem countDigitsMethod = new Interfaces.ActionItem("Count Digits", sr_MenuMethods.CountDigits);
            Interfaces.ActionItem ShowVersionMethod = new Interfaces.ActionItem("Show Version", sr_MenuMethods.ShowVersion);

            subMenu1.AddSubItem(showTimeMethod);
            subMenu1.AddSubItem(showDateMethod);
            subMenu2.AddSubItem(countDigitsMethod);
            subMenu2.AddSubItem(ShowVersionMethod);

            return(InterfacesmainMenu);
        }
Example #2
0
        public static void runInterfaces()
        {
            Interfaces.MainMenu MainMenu           = new Interfaces.MainMenu("Main Menu - Interfaces");
            Interfaces.MenuItem ShowDateOrTime     = new Interfaces.MenuItem(1, "Show Date/Time");
            Interfaces.MenuItem VersionAndCapitals = new Interfaces.MenuItem(2, "Version And Capitals");
            MainMenu.AddSubItem(ShowDateOrTime);
            MainMenu.AddSubItem(VersionAndCapitals);
            Interfaces.MenuItem ShowTime       = new Interfaces.ActionMenu(1, "Show Time");
            Interfaces.MenuItem ShowDate       = new Interfaces.ActionMenu(2, "Show Date");
            Interfaces.MenuItem CountCapitals  = new Interfaces.ActionMenu(1, "Count Capitals");
            Interfaces.MenuItem DisplayVersion = new Interfaces.ActionMenu(2, "Display Version");
            ShowDateOrTime.AddSubItem(ShowTime);
            ShowDateOrTime.AddSubItem(ShowDate);
            VersionAndCapitals.AddSubItem(CountCapitals);
            VersionAndCapitals.AddSubItem(DisplayVersion);
            ShowDate.AttachObserver(new Interfaces.Actions.ShowCurrentDate());
            ShowTime.AttachObserver(new Interfaces.Actions.ShowCurrentTime());
            CountCapitals.AttachObserver(new Interfaces.Actions.CountCapitalsMethod());
            DisplayVersion.AttachObserver(new Interfaces.Actions.DisplayVersionMethod());

            MainMenu.Show();
        }