Ejemplo n.º 1
0
        public TaskRunner(ITaskIO taskIO)
        {
            this.taskIO = taskIO;
            MainMenu    = new Menu("Book catalog", taskIO);

            MainMenu.Items.AddRange(new List <MenuItem>
            {
                new MenuItem()
                {
                    Label    = "Add book",
                    Key      = '1',
                    Function = AddBook
                },
                new MenuItem()
                {
                    Label    = "Find a book by ISBN",
                    Key      = '2',
                    Function = GetBookByISBN
                },
                new MenuItem()
                {
                    Label    = "Find a book by keywords",
                    Key      = '3',
                    Function = GetBooksByKeywords
                },
                new MenuItem()
                {
                    Label    = "Quit",
                    Key      = '0',
                    Function = () => false
                },
                new MenuItem()
                {
                    Label    = "Library",
                    Key      = '8',
                    Function = ListBooks
                },
            });
        }
Ejemplo n.º 2
0
 public Menu(string title, ITaskIO taskIO)
 {
     Items       = new List <MenuItem>();
     this.title  = title;
     this.taskIO = taskIO;
 }