Beispiel #1
0
 public void BuildMenu()
 {
     Ex04.Menus.Delegates.MainMenu menu1    = new Ex04.Menus.Delegates.MainMenu();
     Ex04.Menus.Delegates.SubMenu  subMenu1 = new Ex04.Menus.Delegates.SubMenu("Show Date/Time");
     Ex04.Menus.Delegates.SubMenu  subMenu2 = new Ex04.Menus.Delegates.SubMenu("Version and Capitals");
     menu1.AddMenu(new Method(subMenu1.Name, subMenu1.Run));
     subMenu1.AddMenu(new Method(new ShowDate().Name, ShowTheDate));
     subMenu1.AddMenu(new Method(new ShowTime().Name, ShowTheTime));
     menu1.AddMenu(new Method(subMenu2.Name, subMenu2.Run));
     subMenu2.AddMenu(new Method(new ShowVersion().Name, ShowTheVersion));
     subMenu2.AddMenu(new Method(new CountCapitals().Name, CountCapitalLetters));
     menu1.Show();
 }
        //``Menus``//
        public static void DelegateMenu()
        {
            Ex04.Menus.Delegates.MainMenu   menu        = new Ex04.Menus.Delegates.MainMenu();
            Ex04.Menus.Delegates.MenuItem   main        = menu.AddMenuItem("The main menu");
            Ex04.Menus.Delegates.MenuItem   item1       = menu.AddMenuItem(main, "Vision and spaces");
            Ex04.Menus.Delegates.MenuItem   item2       = menu.AddMenuItem(main, "Show Date/Time");
            Ex04.Menus.Delegates.ActionItem numOfSpaces = menu.AddActionItem(item1, "Count spaces", numOfSpacesInLine);
            Ex04.Menus.Delegates.ActionItem showVersion = menu.AddActionItem(item1, "Show version", showCorrentVersion);
            Ex04.Menus.Delegates.ActionItem dateToday   = menu.AddActionItem(item2, "Show date", showDate);
            Ex04.Menus.Delegates.ActionItem timeNow     = menu.AddActionItem(item2, "Show time", showTime);

            menu.Show(); //Operates the program
        }
Beispiel #3
0
 public static void RunDelegateMenuTest()
 {
     Ex04.Menus.Delegates.MainMenu mainMenu = buildDelegateMenu();
     mainMenu.Show();
 }