static object CreateMenuItemFromDescriptor(NavItemDescriptor descriptor) { Codon codon = descriptor.Codon; string builderid = string.Empty; if (codon.Properties.Contains("builderid")) { builderid = codon.Properties["builderid"]; } else { throw new Exception(string.Format("BuiderID not found:codonid ={0},condonname = {1}", codon.Id, codon.Name)); } if (builderid == string.Empty) { throw new Exception(string.Format("BuiderID is empty:codonid ={0},condonname = {1}", codon.Id, codon.Name)); } IPartBuilder builder = RibbonBuilderManager.GetBuider(builderid); object obj = builder.Build(codon, descriptor.Caller, codon.Conditions); if (obj is ModuleNavBarItem) { ModuleNavBarItem item = obj as ModuleNavBarItem; item.ModuleName = codon.Id; } return(obj); }
private void UnFocusModule(string moduleName) { if (this.navBarControl1.SelectedLink == null) { return; } if (this.navBarControl1.SelectedLink.Item is ModuleNavBarItem) { ModuleNavBarItem focusModule = this.navBarControl1.SelectedLink.Item as ModuleNavBarItem; if (focusModule.ModuleName == moduleName) { this.navBarControl1.SelectedLink = null; } } }
private void FocusModule(string moduleName) { foreach (var item in this.navBarControl1.Items) { if (item is ModuleNavBarItem) { ModuleNavBarItem moduleItem = item as ModuleNavBarItem; if (moduleItem.ModuleName == moduleName) { if (moduleItem.Links.Count > 0) { this.navBarControl1.SelectedLink = moduleItem.Links[0]; } } } } }