private void InitMenus() { // we want the same instance of view in the service, but another // instance on showing presenter the next time, so better not to use DI _menuListener = new LayoutMenuListener(_context, this, _pdfService); _menuGenerator = new LayoutMenuGenerator(_context, _plugin, this, _menuListener); _zoomCombo = _menuGenerator.Toolbars.FindItem(LayoutMenuKeys.ZoomCombo, _plugin.Identity) as IComboBoxMenuItem; if (_zoomCombo != null) { _zoomCombo.ValueChanged += OnZoomComboValueChanged; } }
public LayoutMenuGenerator(IAppContext context, PrintingPlugin plugin, ILayoutView view, LayoutMenuListener listener) { if (plugin == null) { throw new ArgumentNullException("plugin"); } if (view == null) { throw new ArgumentNullException("view"); } if (listener == null) { throw new ArgumentNullException("listener"); } _plugin = plugin; _commands = new LayoutMenuCommands(plugin.Identity); _menu = MenuFactory.CreateMenu(view.MenuManager); _toolbars = MenuFactory.CreateToolbars(view.MenuManager); InitMenu(); ViewMenuHelper.Init(view.MenuManager, view.DockingManager, _menu, view.DockPanels, _plugin.Identity); InitToolbars(); _menu.ItemClicked += listener.OnItemClicked; _toolbars.ItemClicked += listener.OnItemClicked; }