Exemple #1
0
        public void Initialize()
        {
            AddView      addView      = new AddView(controller);
            RemoveView   removeView   = new RemoveView(controller);
            ModifyView   modifyView   = new ModifyView(controller);
            StudentsView studentsView = new StudentsView(controller);

            consoleMenu.AddItem(new MenuItem {
                ShortcutChar = '1', Text = "Add student", ContextObject = addView, ItemAction = new MenuItemAction(AddAction)
            });
            consoleMenu.AddItem(new MenuItem {
                ShortcutChar = '2', Text = "Remove student", ContextObject = removeView, ItemAction = new MenuItemAction(RemoveAction)
            });
            consoleMenu.AddItem(new MenuItem {
                ShortcutChar = '3', Text = "Modify student", ContextObject = modifyView, ItemAction = new MenuItemAction(ModifyAction)
            });
            consoleMenu.AddItem(new MenuItem {
                ShortcutChar = '4', Text = "View students", ContextObject = studentsView, ItemAction = new MenuItemAction(ViewAction)
            });
        }
Exemple #2
0
        public void ViewAction(object sender, object context)
        {
            StudentsView studentsView = (StudentsView)context;

            studentsView.Execute();
        }