Both menus and toolbars are dynamically created using the IMenuManager and IToolbarManager respectively; meaning that they can be created from any plugin loaded into ATLAS 10.
Menu items can be registered using the IMenuRegistry interface. Menus are usually registered at application start up so should be defined in you IPlugin entry class.
If a menu is registered once the application has started up, the IMenuManager will force a rebuild of the menu structure.
// Unique identifier for the source of the menu registration, usually a plugin Id. Guid menuRegistrationSource = Guid.NewGuid(); // The command to be executed when the menu item is selected. ICommand command = new DelegateCommand(this.ExecuteWindowClosingCommand, this.CanExecuteWindowClosingCommand); // Text shown in the menu as a hint for the keyboard shortcut for the menu item. string gestureText = "Alt + F4"; // The initial enabled state of the menu item. bool isEnabled = true; // Whether the menu item shows a check mark (for toggle base menu items). bool isCheckable = false; // The unique index for the menu item. This determines the order in which // the menu item appears in the application. int index = 17; // The physical path of the menu item, indicating its path hierarchy. string[] menuPath = new[] { "_File", "E_xit" }; IMenuRegistration registration = menuRegistry.Register( menuRegistrationSource, command, gestureText, isEnabled, isCheckable, index, menuPath);
Comments
0 comments
Please sign in to leave a comment.