private SidebarControl GetSidebarForCurrentSelection(object selection)
        {
            IHtmlEditorSelection htmlSelection = selection as IHtmlEditorSelection;

            if (selection == null || (!htmlSelection.IsValid && !InlineEditField.IsEditField(selection)))
            {
                return(_defaultSidebarControl);
            }

            foreach (SidebarEntry sidebarEntry in _sidebars)
            {
                ISidebar sidebar = sidebarEntry.Sidebar;
                if (sidebar.AppliesToSelection(selection))
                {
                    SidebarControl sidebarControl = sidebarEntry.SidebarControl;
                    if (sidebarControl == null)
                    {
                        // demand-create sidebar
                        sidebarEntry.SidebarControl         = CreateAndInitializeSidebar(sidebar);
                        sidebarEntry.SidebarControl.Visible = sidebarEntry.SidebarControl.Controls.Count > 0;
                    }
                    return(sidebarEntry.SidebarControl);
                }
            }

            // got this far so no active sidebar for current selection
            return(_defaultSidebarControl);
        }
Example #2
0
        public void Execute(IActionContext context)
        {
            bool state = Core.SettingStore.ReadBool("Tasks", "ShowCompletedTasks", true);

            state = !state;
            Core.SettingStore.WriteBool("Tasks", "ShowCompletedTasks", state);

            ISidebar      rightSidebar = Core.RightSidebar;
            TasksViewPane pane         = (TasksViewPane)rightSidebar.GetPane("ToDo");

            pane.ShowCompletedTaks = state;
        }
        private SidebarControl CreateAndInitializeSidebar(ISidebar sidebar)
        {
            SidebarControl sidebarControl = sidebar.CreateSidebarControl(this);

            sidebarControl.Dock    = DockStyle.Fill;
            sidebarControl.Visible = false;

            //synchronize the scale of the sidebar with this control's scale
            sidebarControl.Scale(new SizeF(scale.Width, scale.Height));

            _mainPanel.Controls.Add(sidebarControl);
            return(sidebarControl);
        }
Example #4
0
        public void Execute(IActionContext context)
        {
            ISidebar rightSidebar = Core.RightSidebar;
//            bool expand = !rightSidebar.IsPaneExpanded( "ToDo" );
            bool expand = !Core.UIManager.RightSidebarExpanded;

            Core.UIManager.RightSidebarExpanded = expand;
            if (expand)
            {
//                Core.UIManager.RightSidebarExpanded = true;
                rightSidebar.SetPaneExpanded("ToDo", expand);
            }
//            rightSidebar.SetPaneExpanded( "ToDo", expand );
        }
 public void RegisterSidebar(ISidebar sidebar)
 {
     // add type without active instance (demand create for startup perf)
     _sidebars.Add(new SidebarEntry(sidebar));
 }
 /// <summary>
 /// Sidebar that will show when no other sidebar needs to show for the
 /// current editor selection
 /// </summary>
 /// <param name="defaultSidebar"></param>
 public void RegisterDefaultSidebar(ISidebar defaultSidebar)
 {
     _defaultSidebarControl = CreateAndInitializeSidebar(defaultSidebar);
 }
Example #7
0
 /// <summary>Static getter for Sidebar Content Area</summary>
 public static IEnumerable <IPublishedContent> GetSidebarContentArea(ISidebar that)
 {
     return(that.GetPropertyValue <IEnumerable <IPublishedContent> >("sidebarContentArea"));
 }
 public SidebarEntry(ISidebar sidebar)
 {
     Sidebar = sidebar;
 }
 public void RegisterSidebar(ISidebar sidebar)
 {
     // add type without active instance (demand create for startup perf)
     _sidebars.Add(new SidebarEntry(sidebar));
 }
 /// <summary>
 /// Sidebar that will show when no other sidebar needs to show for the
 /// current editor selection
 /// </summary>
 /// <param name="defaultSidebar"></param>
 public void RegisterDefaultSidebar(ISidebar defaultSidebar)
 {
     _defaultSidebarControl = CreateAndInitializeSidebar(defaultSidebar);
 }
        private SidebarControl CreateAndInitializeSidebar(ISidebar sidebar)
        {
            SidebarControl sidebarControl = sidebar.CreateSidebarControl(this);
            sidebarControl.Dock = DockStyle.Fill;
            sidebarControl.Visible = false;

            //synchronize the scale of the sidebar with this control's scale
            sidebarControl.Scale(new SizeF(scale.Width, scale.Height));

            _mainPanel.Controls.Add(sidebarControl);
            return sidebarControl;
        }
 public SidebarEntry(ISidebar sidebar)
 {
     Sidebar = sidebar;
 }
Example #13
0
 public SideBarView(ISidebar sideBar)
 {
     InitializeComponent();
     this.DataContext = sideBar;
 }