Esempio n. 1
0
 private static IEnumerable <IMenuItem> CreateMenuItems(AddressBookApplication addressBookApplication, AddressBook addressBook)
 {
     return(new List <IMenuItem>
     {
         new LabelMenuItem
         {
             Text = "Add Person",
             Command = new AddPersonCommand(addressBook)
         },
         new LabelMenuItem
         {
             Text = "Display Persons",
             Command = new DisplayPersonsCommand(addressBook)
         },
         new LabelMenuItem
         {
             Text = "Display Person Details",
             Command = new DisplayPersonDetailsCommand(addressBook)
         },
         new SeparatorMenuItem(),
         new LabelMenuItem
         {
             Text = "Exit",
             Command = new ExitCommand(addressBookApplication)
         }
     });
 }
Esempio n. 2
0
        private static void Main(string[] args)
        {
            Console.BufferWidth = 80;

            DisplayApplicationHeader();

            AddressBookApplication application = new AddressBookApplication();

            application.Run();
        }
Esempio n. 3
0
        public MainMenu(AddressBookApplication addressBookApplication, AddressBook addressBook)
        {
            if (addressBookApplication == null)
            {
                throw new ArgumentNullException(nameof(addressBookApplication));
            }
            if (addressBook == null)
            {
                throw new ArgumentNullException(nameof(addressBook));
            }

            IEnumerable <IMenuItem> menuItems = CreateMenuItems(addressBookApplication, addressBook);

            AddItems(menuItems);
        }