public void SetView(HeadingPanelView view) { View = view; ActiveAware = new FocusActiveAwareAdapter(View); ActiveAware.IsActiveChanged += (sender, e) => refreshCommandsIsActive(); m_ShellView.ActiveAware.IsActiveChanged += (sender, e) => refreshCommandsIsActive(); }
public HeadingNavigationPlugin( ILoggerFacade logger, IRegionManager regionManager, [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)] IUrakawaSession session, [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)] IShellView shellView, [Import(typeof(HeadingPanelView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)] HeadingPanelView pane) //HeadingPaneViewModel { m_Logger = logger; m_RegionManager = regionManager; m_UrakawaSession = session; m_ShellView = shellView; m_TocPane = pane; // Remark: using direct access instead of delayed lookup (via the region registry) // generates an exception, because the region does not exist yet (see "parent" plugin constructor, RegionManager.SetRegionManager(), etc.) m_RegionManager.RegisterNamedViewWithRegion(RegionNames.NavigationPaneTabs, new PreferredPositionNamedView { m_viewInstance = m_TocPane, m_viewName = @"ViewOf_" + RegionNames.NavigationPaneTabs + @"_Headings", m_viewPreferredPosition = PreferredPosition.First } ); //m_RegionManager.RegisterViewWithRegion(RegionNames.NavigationPaneTabs, typeof(IHeadingPaneView)); //IRegion targetRegion = m_RegionManager.Regions[RegionNames.NavigationPaneTabs]; //targetRegion.Add(m_TocPane); //targetRegion.Activate(m_TocPane); //m_Logger.Log(@"Navigation pane plugin initializing...", Category.Debug, Priority.Medium); }
public NavigationPane( IRegionManager regionManager, [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)] IShellView shellView, [Import(typeof(HeadingPanelView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)] HeadingPanelView tocView, [Import(typeof(PagePanelView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)] PagePanelView pagesView, [Import(typeof(MarkersPanelView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)] MarkersPanelView markersView) { m_RegionManager = regionManager; m_ShellView = shellView; m_PagePaneView = pagesView; m_HeadingPaneView = tocView; m_MarkersPaneView = markersView; InitializeComponent(); RegionManager.SetRegionManager(this, m_RegionManager); RegionManager.UpdateRegions(); CommandFocus = new RichDelegateCommand( Tobi_Plugin_NavigationPane_Lang.CmdNavigationFocus_ShortDesc, null, null, // KeyGesture obtained from settings (see last parameters below) m_ShellView.LoadTangoIcon("start-here"), () => { IRegion tabRegion = m_RegionManager.Regions[RegionNames.NavigationPaneTabs]; UIElement ui = null; foreach (var view in tabRegion.ActiveViews) // should be just only one { if (view is ITobiViewFocusable) { ui = ((ITobiViewFocusable)view).FocusableItem; break; } else { //if (view == m_PagePaneView.ViewControl) //{ // ui = m_PagePaneView.ViewFocusStart; // if (ui.Focusable) // break; //} //if (view == m_HeadingPaneView.ViewControl) //{ // ui = m_HeadingPaneView.ViewFocusStart; // if (ui.Focusable) // break; //} //if (view == m_MarkersPaneView.ViewControl) //{ // ui = m_MarkersPaneView.ViewFocusStart; // if (ui.Focusable) // break; //} #if DEBUG Debugger.Break(); #endif ui = FocusHelper.GetLeafFocusableChild((UIElement)view); } } if (ui != null && ui.Focusable) { FocusHelper.FocusBeginInvoke(ui); } }, () => true, Settings_KeyGestures.Default, PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Focus_Nav)); m_ShellView.RegisterRichCommand(CommandFocus); }