private void _navigationBar_SelectedButtonChanged(object sender, EventArgs e) { ISelectionService service = (ISelectionService)this.GetService(typeof(ISelectionService)); if (service != null) { ICollection selectedComponents = service.GetSelectedComponents(); bool flag = false; foreach (object selectedComponent in selectedComponents) { NuGenNavigationPane navigationPaneOfComponent = NuGenNavigationBarDesigner.GetNavigationPaneOfComponent(selectedComponent); if ( navigationPaneOfComponent != null && navigationPaneOfComponent.Parent == _navigationBar && navigationPaneOfComponent == _navigationBar.SelectedNavigationPane ) { flag = true; break; } } if (!flag) { service.SetSelectedComponents(new object[] { base.Component }); } } }
/* * RemoveNavigationPane */ /// <summary> /// </summary> public virtual void RemoveNavigationPane() { NuGenNavigationPane selectedNavigationPane = _navigationBar.SelectedNavigationPane; if (selectedNavigationPane != null) { this.DestroyNavigationPane(selectedNavigationPane); } }
private void _navigationBar_NavigationPaneRemoved(object sender, NuGenCollectionEventArgs <NuGenNavigationPane> e) { NuGenNavigationPane navigationPaneToRemove = e.Item; if (navigationPaneToRemove != null) { this.DestroyNavigationPane(navigationPaneToRemove); } }
/* * GetSelectedNavigationPaneDesigner */ /// <summary> /// </summary> protected NuGenNavigationPaneDesigner GetSelectedNavigationPaneDesigner() { NuGenNavigationPaneDesigner navigationPaneDesigner = null; NuGenNavigationPane selectedNavigationPane = _navigationBar.SelectedNavigationPane; if (selectedNavigationPane != null) { IDesignerHost host = (IDesignerHost)this.GetService(typeof(IDesignerHost)); if (host != null) { navigationPaneDesigner = host.GetDesigner(selectedNavigationPane) as NuGenNavigationPaneDesigner; } } return(navigationPaneDesigner); }
private void _selectionService_SelectionChanged(object sender, EventArgs e) { ISelectionService service = (ISelectionService)this.GetService(typeof(ISelectionService)); if (service != null) { ICollection selectedComponents = service.GetSelectedComponents(); foreach (object selectedComponent in selectedComponents) { NuGenNavigationPane navigationPaneOfComponent = NuGenNavigationBarDesigner.GetNavigationPaneOfComponent(selectedComponent); if (navigationPaneOfComponent != null && navigationPaneOfComponent.Parent == _navigationBar) { _navigationBar.SelectedNavigationPane = navigationPaneOfComponent; break; } } } }
/* * DestroyNavigationPane */ /// <summary> /// </summary> /// <exception cref="ArgumentNullException"> /// <para> /// <paramref name="navigationPaneToDestroy"/> is <see langword="null"/>. /// </para> /// </exception> protected void DestroyNavigationPane(NuGenNavigationPane navigationPaneToDestroy) { if (navigationPaneToDestroy == null) { throw new ArgumentNullException("navigationPaneToDestroy"); } IDesignerHost host = (IDesignerHost)this.GetService(typeof(IDesignerHost)); if (host != null) { DesignerTransaction transaction = null; try { try { transaction = host.CreateTransaction("NuGenNavigationBar.RemoveNavigationPane"); } catch (CheckoutException e) { if (e != CheckoutException.Canceled) { throw; } return; } _navigationBar.NavigationPanes.Remove(navigationPaneToDestroy); host.DestroyComponent(navigationPaneToDestroy); } finally { if (transaction != null) { transaction.Commit(); } } } }