示例#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)
            });
        }
示例#2
0
        public void AddAction(object sender, object context)
        {
            AddView addView = (AddView)context;

            addView.Execute();
        }