private RibbonMenuButtonData ConfigureSplitButton() { var splitButton = new RibbonMenuButtonData(Messages.Title_BtnAdd, imgUri.FormatWith("Add"), AddRecordCommand); var addRecordButton = new RibbonMenuItemData(Messages.Title_AddRecord, imgUri.FormatWith("Add"), AddRecordCommand); var addFolderButton = new RibbonMenuItemData(Messages.Title_AddFolder, imgUri.FormatWith("Add"), AddFolderCommand); splitButton.ControlDataCollection.Add(addRecordButton); splitButton.ControlDataCollection.Add(addFolderButton); return splitButton; }
private void BuildButtons() { #region Add var splitterExist = true; var splitter = PluginContext.Host.GetMenuInHome("add", Groups.Tools); if (splitter == null || splitter.GetType() != typeof(RibbonMenuButtonData)) { splitterExist = false; splitter = new RibbonMenuButtonData(Messages.Btn_Add, uriPng.FormatWith("Add"), null) { Order = 1, Name = "add", }; } var addButton = new RibbonMenuItemData(Messages.Title_ButtonAddPatient, uriPng.FormatWith("Add"), this.AddCommand) { Order = 2, }; (splitter as RibbonMenuButtonData).Command = AddCommand; (splitter as RibbonMenuButtonData).ControlDataCollection.Add(addButton); if (!splitterExist) PluginContext.Host.AddInHome((splitter as RibbonMenuButtonData), Groups.Tools); #endregion #region Search var searchButton = new RibbonButtonData(Messages.Title_SearchPatient, this.SearchCommand) { SmallImage = new Uri(uriPng.FormatWith("SearchSmall"), UriKind.Relative), Order = 0, }; var extendedSerchButton = new RibbonButtonData(Messages.Title_ExtendedSearchPatient, this.ExtendedSearchCommand) { SmallImage = new Uri(uriPng.FormatWith("SearchSmall"), UriKind.Relative), Order = 0, }; var topTenButton = new RibbonButtonData(Messages.Title_MostUsed, this.ShowTopTenCommand) { SmallImage = new Uri(uriPng.FormatWith("SearchSmall"), UriKind.Relative), Order = 0, }; var searchByTagButton = new RibbonSplitButtonData(Messages.Title_SearchByTag, uriPng.FormatWith("SearchSmall"), this.SearchByTagCommand) { Order = 0, }; var searchSplitButton = new RibbonSplitButtonData(Messages.Title_ButtonSearch, uriIco.FormatWith("Search"), this.SearchCommand) { Order = 0, }; searchSplitButton.ControlDataCollection.Add(searchButton); searchSplitButton.ControlDataCollection.Add(extendedSerchButton); searchSplitButton.ControlDataCollection.Add(topTenButton); searchSplitButton.ControlDataCollection.Add(searchByTagButton); PluginContext.Host.AddInHome(searchSplitButton, Groups.Tools); #endregion }
/// <summary> /// Initialises this plugin. Basicaly it should configure the menus into the PluginHost /// Every task that could throw exception should be in this method and not in the ctor. /// </summary> public override void Initialise() { this.ConfigureAutoMapper(); this.ConfigureViewService(); this.component = PluginContext.ComponentFactory.GetInstance<IUserSessionComponent>(); TranslateExtension.ResourceManager = Messages.ResourceManager; var splitter = PluginContext.Host.GetMenuInHome("add", Groups.Tools); var splitterExist = true; if (splitter == null || splitter.GetType() != typeof(RibbonMenuButtonData)) { splitterExist = false; splitter = new RibbonMenuButtonData(Messages.Btn_Add, uri.FormatWith("Add"), null) { Order = 1, Name = "add", }; } var addButton = new RibbonMenuItemData(Messages.Title_ButtonAddUser, uri.FormatWith("Add"), this.addUserCommand) { Order = 3, }; (splitter as RibbonMenuButtonData).ControlDataCollection.Add(addButton); if (!splitterExist) PluginContext.Host.AddInHome((splitter as RibbonMenuButtonData), Groups.Tools); var navigateButton = new RibbonButtonData(Messages.Title_Deconnection , uri.FormatWith("Administration") , this.DisconnectCommand) { Order = int.MaxValue - 1 }; PluginContext.Host.AddToApplicationMenu(navigateButton); this.InitialiseConnectionPage(); this.InitialiseUpdateUserPage(); }