Esempio n. 1
0
        public void SetView(MarkersPanelView view)
        {
            View = view;

            ActiveAware = new FocusActiveAwareAdapter(View);
            ActiveAware.IsActiveChanged             += (sender, e) => refreshCommandsIsActive();
            m_ShellView.ActiveAware.IsActiveChanged += (sender, e) => refreshCommandsIsActive();
        }
        public MarkersNavigationPlugin(
            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(MarkersPanelView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            MarkersPanelView pane,
            [Import(typeof(MarkersPaneViewModel), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            MarkersPaneViewModel viewModel
            )
        {
            m_Logger        = logger;
            m_RegionManager = regionManager;

            m_UrakawaSession   = session;
            m_ShellView        = shellView;
            m_MarkersPane      = pane;
            m_MarkersViewModel = viewModel;

            // 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_MarkersPane,
                m_viewName              = @"ViewOf_" + RegionNames.NavigationPaneTabs + @"_Markers",
                m_viewPreferredPosition = PreferredPosition.Last
            });

            //m_RegionManager.RegisterViewWithRegion(RegionNames.NavigationPaneTabs, typeof(IMarkersPaneView));

            //IRegion targetRegion = m_RegionManager.Regions[RegionNames.NavigationPaneTabs];
            //targetRegion.Add(m_MarkersPane);
            //targetRegion.Activate(m_MarkersPane);

            //m_Logger.Log(@"Navigation pane plugin initializing...", Category.Debug, Priority.Medium);
        }
Esempio n. 3
0
 public MarkersNavigator(MarkersPanelView view)
 {
     m_view = view;
 }
        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);
        }