Exemplo n.º 1
0
        protected virtual void MenuItemAndToolbarInitialize(Type type, string topMenuHeader, string topMenuName)
        {
            IModuleResources resources = GetModuleResources();
            ObservableCollection <CommandInfo> commandInfos = resources.GetCommandInfos(type);

            foreach (CommandInfo info in commandInfos)
            {
                CommandBinding cmdBinding = CreateCommandBindingFroUICommand(info.Command);
                if (cmdBinding != null)
                {
                    info.CommandBinding = cmdBinding;
                }
            }

            AddCommandInfosIntoGlobalCommands(commandInfos);

            _eventAggregator.GetEvent <ToolbarButtonAddedEvent>().Publish(commandInfos);

            ObservableCollection <MenuItem> menuItems = GetMenuItemsWithTopMenuItem(commandInfos, topMenuHeader, topMenuName);

            _eventAggregator.GetEvent <MenuItemAddedEvent>().Publish(menuItems);
        }