private FrameworkElement insertPlugin(Dictionary<String, IAddChild> pluginRoots, IAddChild defaultPluginRoot) { try { var assembly = System.Reflection.Assembly.LoadFrom(root + "\\" + name + ".dll"); var pluginMain = assembly.GetType(name + ".PluginMain"); var pluginInstance = (UserControl)pluginMain.GetConstructor(new Type[0]).Invoke(new object[0]); var pluginGroup = new RibbonGroup(); if (pluginMain.GetFields().Where(f => f.Name == "preferredTab").Count() == 1) { var preferredTab = (string)pluginMain.GetField("preferredTab").GetValue(pluginInstance); if (preferredTab == "PenTools" || preferredTab == "Navigate") { pluginRoots[preferredTab].AddChild(pluginInstance); return pluginInstance; } if (pluginRoots.ContainsKey(preferredTab)) { pluginGroup.Header = name; pluginGroup.Items.Add(pluginInstance); pluginRoots[preferredTab].AddChild(pluginGroup); } else { throw new InvalidPluginFormatException(name, "This plugin has requested to live in a tab which does not exist: " + preferredTab + ". Available tabs are: " + pluginRoots.Keys.Aggregate("", (key, acc) => key + " " + acc)); } } else { //Uncomment these lines to make the plugin live in a RibbonGroup that will collapse at priority 9, go to small at 8 and go to medium at 7. //pluginGroup.Variants.Add(new GroupVariant(pluginGroup,RibbonGroupVariant.Collapsed,9)); //pluginGroup.Variants.Add(new GroupVariant(pluginGroup,RibbonGroupVariant.Small,8)); //pluginGroup.Variants.Add(new GroupVariant(pluginGroup,RibbonGroupVariant.Medium,7)); pluginGroup.Header = name; pluginGroup.Items.Add(pluginInstance); defaultPluginRoot.AddChild(pluginGroup); } return pluginInstance; } catch (Exception e) { throw new InvalidPluginFormatException(name, "This plugin has failed to instantiate its main class (which must be named PluginMain) correctly, failing with the error: " + e.Message); } }
private RibbonTab CreateMenu() { this.PersonMainMenu = new ButtonCommand(); this.PersonMainGroup = new RibbonGroup(); this.PersonMainTab = new RibbonTab(); this.AddPersonMenu = new ButtonCommand(); PersonMainTab.Text = "Администрација"; PersonMainTab.Name = "rtabAdministration"; PersonMainTab.Key = "rtabAdministration"; PersonMainGroup.Text = "Вработени"; PersonMainGroup.Name = "rgEmployee"; PersonMainGroup.Key = "rgEmployee"; PersonMainMenu.Text = "Вработени"; PersonMainMenu.Name = "pcbPersonMainMenu"; PersonMainMenu.Click += AdministrationCommandFacade.PersonList; PersonMainMenu.SizeStyle = CommandSizeStyle.Large; AddPersonMenu.Text = "Додади Вработен"; AddPersonMenu.Name = "pcbAddPersonMenu"; AddPersonMenu.Click += AdministrationCommandFacade.AddPerson; AddPersonMenu.SizeStyle = CommandSizeStyle.Small; PersonMainGroup.Commands.Add(PersonMainMenu); PersonMainGroup.Commands.Add(AddPersonMenu); PersonMainTab.Groups.Add(PersonMainGroup); return PersonMainTab; }
protected void SetupRibbon() { ASPxRibbon ribbon = new ASPxRibbon(); RibbonTab tab = new RibbonTab(); RibbonGroup group = new RibbonGroup(); group.Name = "Editing"; group.Text = "Editing"; RibbonButtonItem saveItem = new RibbonButtonItem { Name = "Save", Text = "Save", Size = RibbonItemSize.Large }; saveItem.LargeImage.IconID = IconImage.Save_Large; group.Items.Add(saveItem); //if (fieldLegalValueConfiguration.Oid != Guid.Empty) { // RibbonButtonItem deleteItem = new RibbonButtonItem // { // Name = "Delete", // Text = "Delete", // Size = RibbonItemSize.Large // }; // deleteItem.LargeImage.IconID = "actions_close_32x32"; // group.Items.Add(deleteItem); //} tab.Groups.Add(group); ribbon.Tabs.Add(tab); ribbon.ShowTabs = false; ShowRibbon(ribbon); }
public void OnMetadataChanged() { Items.Clear(); var ribbonProvider = VisualMainWindow.ApplicationProxy.ServicePool.GetSingelService<IRibbonContentProviderService>(); if (ribbonProvider != null) { foreach (var generateTab in ribbonProvider.GenerateTabs(Metadatas).OrderBy(s => s.TabIndex)) { var tab = new RibbonTab(); tab.Header = generateTab.Header; foreach (var ribbonGroup in generateTab.Groups.OrderBy(s => s.GroupIndex)) { var group = new RibbonGroup(); group.Header = ribbonGroup.Header; foreach (var button in ribbonGroup.Buttons) { group.Items.Add(button); } tab.Items.Add(group); } Items.Add(tab); } } }
public static RibbonGroupBuilder Group(this RibbonTabBuilder builder, string title, string id = null) { var g = new RibbonGroup(builder.CurrentRibbon.Helper, title) { Id =id }; builder.CurrentTab.Groups.Add(g); return RibbonGroupBuilder.CreateGroupBuilder(builder.CurrentRibbon); }
private void loadform() { RibbonTab hometab = new RibbonTab("Home"); this.ultToolsbarmgr.Ribbon.Tabs.Add(hometab); RibbonGroup newgroup = new RibbonGroup("New"); this.ultToolsbarmgr.Ribbon.Tabs["Home"].Groups.Add(newgroup); //RibbonGroupCollection collection= new RibbonGroupCollection(); //collection.Add("Customer"); //FontListTool fontFaceTool = new FontListTool("Fontface"); //this.ultToolsbarmgr.Tools.Add(fontFaceTool); //fontgrop.Tools.AddTool(fontFaceTool.Key, false); }
public KeyTipAdorner(UIElement adornedElement, UIElement placementTarget, KeyTipHorizontalPlacement horizontalPlacement, KeyTipVerticalPlacement verticalPlacement, double horizontalOffset, double verticalOffset, RibbonGroup ownerRibbonGroup) : base(adornedElement) { PlacementTarget = (placementTarget == null ? adornedElement : placementTarget); HorizontalPlacement = horizontalPlacement; VerticalPlacement = verticalPlacement; HorizontalOffset = horizontalOffset; VerticalOffset = verticalOffset; OwnerRibbonGroup = ownerRibbonGroup; }
protected void SetupRibbon() { ASPxRibbon ribbon = new ASPxRibbon(); ribbon.ShowTabs = false; RibbonTab tab = new RibbonTab(); RibbonGroup optionsGroup = new RibbonGroup(); optionsGroup.Name = "Options"; optionsGroup.Text = "Options"; optionsGroup.Items.Add(RibbonButtonItem("StartImport", "Start Import", RibbonItemSize.Large, IconImage.Upload_Large)); tab.Groups.Add(optionsGroup); ribbon.Tabs.Add(tab); ShowRibbon(ribbon); }
private RibbonTab CreateMenu() { this.PlanningMainMenu = new ButtonCommand(); this.PlanningMainGroup = new RibbonGroup(); this.PlanningMainTab = new RibbonTab(); PlanningMainTab.Text = "Планирање"; PlanningMainTab.Name = "rtabPlanning"; PlanningMainTab.Key = "rtabPlanning"; PlanningMainGroup.Text = "Планирање"; PlanningMainGroup.Name = "rgPlanning"; PlanningMainGroup.Key = "rgPlanning"; PlanningMainMenu.Text = "Форма"; PlanningMainMenu.Name = "pcbPlanning"; PlanningMainMenu.Click += PlanningCommandFacade.ViewPlanning; PlanningMainMenu.SizeStyle = CommandSizeStyle.Large; PlanningMainGroup.Commands.Add(PlanningMainMenu); PlanningMainTab.Groups.Add(PlanningMainGroup); return PlanningMainTab; }
internal void OnChildGroupRenderSizeChanged(RibbonGroup group, double originalWidth) { if (!_changedWidthGroups.ContainsKey(group)) { _changedWidthGroups[group] = originalWidth; } if (!_processGroupWidthChangeQueued) { _processGroupWidthChangeQueued = true; Dispatcher.BeginInvoke( (Action)delegate() { if (_changedWidthGroups.Count > 0) { foreach (RibbonGroup invalidGroup in _changedWidthGroups.Keys) { double originalRenderWidth = _changedWidthGroups[invalidGroup]; if (!DoubleUtil.AreClose(originalRenderWidth, invalidGroup.ActualWidth)) { // Reset the next increase group's cached data // if there was a real change in any groups width. ResetNextIncreaseGroupCache(); InvalidateMeasure(); break; } } } _changedWidthGroups.Clear(); _processGroupWidthChangeQueued = false; }, DispatcherPriority.Input, null); } }
protected void SetupRibbon() { ASPxRibbon ribbon = new ASPxRibbon(); RibbonTab tab = new RibbonTab(); RibbonGroup editingGroup = new RibbonGroup(); editingGroup.Name = "Editing"; editingGroup.Text = "Editing"; RibbonButtonItem saveItem = new RibbonButtonItem { Name = "Save", Text = "Save", Size = RibbonItemSize.Large }; saveItem.LargeImage.IconID = IconImage.Save_Large; editingGroup.Items.Add(saveItem); if (SessionData().fieldLegalValueConfiguration.Oid != Guid.Empty) { editingGroup.Items.Add(RibbonButtonItem("Delete", RibbonItemSize.Large, IconImage.Delete_Large)); RibbonButtonItem newItem = new RibbonButtonItem { Name = "New", Text = "New", Size = RibbonItemSize.Small, NavigateUrl = UrlManager.FieldLegalValueConfigurationSaveWithOid(Guid.Empty, phonebook.Oid) }; newItem.SmallImage.IconID = IconImage.New_Small; editingGroup.Items.Add(newItem); } if (IsPostBack == true) { editingGroup.Items.Add(RibbonButtonItem("Reset", "Reset", RibbonItemSize.Small, IconImage.Refresh_Small, Request.RawUrl)); } tab.Groups.Add(editingGroup); RibbonGroup actionGroup = new RibbonGroup(); actionGroup.Text = "Action"; RibbonButtonItem autoCorrectItem = RibbonButtonItem("Translate", "Autocorrect data", RibbonItemSize.Large, IconImage.Convert_Large, UrlManager.PhonebooksTranslateDataWithPhonebook(phonebook.Oid, SessionData().fieldLegalValueConfiguration.Oid), HelpText.TranslationDescription); bool enabled = SessionData().fieldLegalValueConfiguration.Oid != Guid.Empty && (IsPostBack == false || didJustSave == true); autoCorrectItem.ClientEnabled = enabled; autoCorrectItem.ToolTip = enabled ? "Click here to go to the auto-corrections page" : "Save or reset to begin auto correcting your data"; actionGroup.Items.Add(autoCorrectItem); tab.Groups.Add(actionGroup); ribbon.Tabs.Add(tab); ribbon.ShowTabs = false; ShowRibbon(ribbon); }
private void setupTableColumnIndexTab() { var btOpenTable = new ButtonTool("btOpenTable"); btOpenTable.SharedProps.Caption = "Open Table"; btOpenTable.SharedProps.AppearancesSmall.Appearance.Image = 4; var btScriptTable = new ButtonTool("btScriptTable"); btScriptTable.SharedProps.Caption = "Script Table"; btScriptTable.SharedProps.AppearancesSmall.Appearance.Image = 4; var btAnalyzeTable = new ButtonTool("btAnalyzeTable"); btAnalyzeTable.SharedProps.Caption = "Analyze Table"; btAnalyzeTable.SharedProps.AppearancesSmall.Appearance.Image = 4; var btAddColumn = new ButtonTool("btAddColumn"); btAddColumn.SharedProps.Caption = "Add Column"; btAddColumn.SharedProps.AppearancesSmall.Appearance.Image = 4; var btAddIndex = new ButtonTool("btAddIndex"); btAddIndex.SharedProps.Caption = "Add Index"; btAddIndex.SharedProps.AppearancesSmall.Appearance.Image = 4; _view.tbManager.Tools.Add(btOpenTable); _view.tbManager.Tools.Add(btScriptTable); _view.tbManager.Tools.Add(btAnalyzeTable); _view.tbManager.Tools.Add(btAddColumn); _view.tbManager.Tools.Add(btAddIndex); var rtTable = new RibbonTab("rtTable", "Table, Column, Index"); var rgTable = new RibbonGroup("rgTable", "Table"); rgTable.Tools.Add(btOpenTable); rgTable.Tools.Add(btScriptTable); rgTable.Tools.Add(btAnalyzeTable); rgTable.Tools.Add(btAddColumn); rgTable.Tools.Add(btAddIndex); rtTable.Groups.Add(rgTable); _view.tbManager.Ribbon.Tabs.Add(rtTable); // Column group var btAlterColumn = new ButtonTool("btAlterColumn"); btAlterColumn.SharedProps.Caption = "Alter Column"; btAlterColumn.SharedProps.AppearancesSmall.Appearance.Image = 11; _view.tbManager.Tools.Add(btAlterColumn); var rgColumn = new RibbonGroup("rgColumn", "Column"); rgColumn.Tools.Add(btAlterColumn); rtTable.Groups.Add(rgColumn); // Index group var btRebuildIndex = new ButtonTool("btRebuildIndex"); btRebuildIndex.SharedProps.Caption = "Rebuild Index"; btRebuildIndex.SharedProps.AppearancesSmall.Appearance.Image = 11; var btReorganizeIndex = new ButtonTool("btReorganizeIndex"); btReorganizeIndex.SharedProps.Caption = "Reorganize Index"; btReorganizeIndex.SharedProps.AppearancesSmall.Appearance.Image = 11; _view.tbManager.Tools.Add(btRebuildIndex); _view.tbManager.Tools.Add(btReorganizeIndex); var rgIndex = new RibbonGroup("rgIndex", "Index"); rgIndex.Tools.Add(btRebuildIndex); rgIndex.Tools.Add(btReorganizeIndex); rtTable.Groups.Add(rgIndex); }
private void inizializza(string statoAttivita) { var messaggi = new RibbonGroup("messaggi") { Caption = @"Messaggi", LayoutDirection = RibbonGroupToolLayoutDirection.Vertical, PreferredToolSize = RibbonToolSize.Large }; ultraToolbarsManagerStandard.Ribbon.Tabs["home"].Groups.Add(messaggi); messaggi.Tools.AddTool("controlloRapportino"); // Inserisco i validatori mainValidationSummary.Validators.Add(reqResponsabile); mainValidationSummary.Validators.Add(reqTipoAttivita); mainValidationSummary.Validators.Add(customValidatorSoggettoAttivo); mainValidationSummary.Validators.Add(reqPriorita); mainValidationSummary.Validators.Add(dataFineValidator); validationSummaryLettera.Validators.Add(reqModelliLettera); validationSummaryLettera.Validators.Add(customValidatorSoggettoAttivo); validationSummaryInvioMessaggio.Validators.Add(reqTipoMessaggio); //Se l'attività è chiusa viene disabilitato il pulsante per la chiusura della attività if (!statoAttivita.Equals("Chiusa")) { var propBtnTermina = new CustomControlProperties {AlwaysEnable = true}; btnTermina.Tag = propBtnTermina; } else { var propBtnTermina = new CustomControlProperties {AlwaysEnable = false}; btnTermina.Tag = propBtnTermina; } var propLettera = new CustomControlProperties {AlwaysEnable = true}; btnLettera.Tag = propLettera; btnInvia.Tag = propLettera.Clone(); modelliLettera.Tag = propLettera.Clone(); personaContattare.Tag = propLettera.Clone(); priorita.ValueList.DisplayStyle = ValueListDisplayStyle.DisplayTextAndPicture; priorita.Items[0].Appearance.BackColor = Color.Green; priorita.Items[1].Appearance.BackColor = Color.Yellow; priorita.Items[2].Appearance.BackColor = Color.Red; tipoMessaggio.ValueList = DataSourceHelper.GetValueList<TipoMessaggio>("tipoMessaggio"); var propAlwaysEnable = new CustomControlProperties { AlwaysEnable = true }; tipoMessaggio.Tag = propAlwaysEnable; btnAlert.Tag = propAlwaysEnable.Clone(); txtNote.ReadOnly = true; txtNote.ShowHideMailMerge(false); }
public static Ribbon ribbon(this RibbonGroup ribonGroup) { return((Ribbon)ribonGroup.wpfInvoke( () => { return ribonGroup.Ribbon; })); }
/// <summary> /// Allocation algorithm for star values. /// </summary> private double AllocateStarValues(RibbonGroup ribbonGroup, double remainingSpace) { List <StarLayoutInfo> starInfoList = new List <StarLayoutInfo>(2); List <IProvideStarLayoutInfo> starLayoutInfoProviders = new List <IProvideStarLayoutInfo>(2); // creates a list of appropriate candidates for star allocation foreach (IProvideStarLayoutInfo starLayoutInfoProvider in _registeredStarLayoutProviders) { bool considerForAllocation = ((ribbonGroup == null && starLayoutInfoProvider.TargetElement is RibbonGroup) || ribbonGroup == starLayoutInfoProvider.TargetElement); bool added = false; IEnumerable <StarLayoutInfo> starLayoutCombinations = starLayoutInfoProvider.StarLayoutCombinations; if (starLayoutCombinations != null) { foreach (StarLayoutInfo starLayoutInfo in starLayoutCombinations) { if (starLayoutInfo != null && DoubleUtil.GreaterThan(starLayoutInfo.RequestedStarWeight, 0)) { starLayoutInfo.AllocatedStarWidth = starLayoutInfo.RequestedStarMinWidth; if (considerForAllocation) { added = true; starInfoList.Add(starLayoutInfo); } } } } if (added) { starLayoutInfoProviders.Add(starLayoutInfoProvider); } } if (DoubleUtil.GreaterThan(remainingSpace, 0)) { // Tries to equalize the perstarspace of star element // constrained by their min/max constraints and available space. starInfoList.Sort(StarLayoutInfo.PerStarValueComparer); int rightMostEqualizerIndex = -1; EqualizeStarValues(starInfoList, ref remainingSpace, out rightMostEqualizerIndex); // Distributes the remaining space after step 1 equally among all the // qualified member, such that they are constrained by their min/max constraints // maintaining (but not necessarily attaining) the goal of making perstarvalue of // all the elements as equal as possible. if (rightMostEqualizerIndex >= 0 && DoubleUtil.GreaterThan(remainingSpace, 0)) { starInfoList.Sort(0, rightMostEqualizerIndex + 1, StarLayoutInfo.PotentialPerStarValueComparer); DistributeRemainingSpace(starInfoList, (rightMostEqualizerIndex + 1), ref remainingSpace); } } foreach (IProvideStarLayoutInfo starLayoutInfoProvider in starLayoutInfoProviders) { starLayoutInfoProvider.OnStarSizeAllocationCompleted(); } return(remainingSpace); }
public void PruebaTonta() { RibbonTab tab = new RibbonTab() { Header = "Mi Pestaña", Tag = Guid.NewGuid() }; RibbonGroup group = new RibbonGroup() { Header = "Mi Grupo", Tag = Guid.NewGuid() }; RibbonButton button = new RibbonButton() { //Command = Label = "Mi Botón", Tag = Guid.NewGuid() }; group.Items.Add(button); tab.Items.Add(group); this.InnerRibbon.Items.Add(tab); }
public override void Initialize() { // Now create a Ribbon Tab and add it to the ribbonTabs collection ribbonTab = new RibbonTab(RibbonNames.tabName, RibbonNames.tabName); workItem.RootWorkItem.UIExtensionSites["ribbonTabs"].Add <RibbonTab>(ribbonTab); // Set the Tag property to the WorkItem // this will allow the Shell to activate the WorkItem given the RibbonTab ribbonTab.Tag = workItem; // Now register the ribbon tab's Groups collection workItem.RootWorkItem.UIExtensionSites.RegisterSite("discoverRibbonGroups", ribbonTab.Groups); adRibbonGroup = new RibbonGroup(RibbonNames.adGroupName); adRibbonGroup.Caption = RibbonNames.adGroupName; adRibbonGroup.PreferredToolSize = RibbonToolSize.Large; workItem.UIExtensionSites["discoverRibbonGroups"].Add <RibbonGroup>(adRibbonGroup); // Now register the Active Directory group Tools collection workItem.RootWorkItem.UIExtensionSites.RegisterSite("adRibbonTools", adRibbonGroup.Tools); InitializeADTools(); netbiosRibbonGroup = new RibbonGroup(RibbonNames.netbiosGroupName); netbiosRibbonGroup.Caption = RibbonNames.netbiosGroupName; netbiosRibbonGroup.PreferredToolSize = RibbonToolSize.Large; workItem.UIExtensionSites["discoverRibbonGroups"].Add <RibbonGroup>(netbiosRibbonGroup); // Now register the NetBIOS group Tools collection workItem.RootWorkItem.UIExtensionSites.RegisterSite("netbiosRibbonTools", netbiosRibbonGroup.Tools); InitializeNetbiosTools(); tcpipRibbonGroup = new RibbonGroup(RibbonNames.tcpipGroupName); tcpipRibbonGroup.Caption = RibbonNames.tcpipGroupName; tcpipRibbonGroup.PreferredToolSize = RibbonToolSize.Large; workItem.UIExtensionSites["discoverRibbonGroups"].Add <RibbonGroup>(tcpipRibbonGroup); // Now register the TCP/IP group Tools collection workItem.RootWorkItem.UIExtensionSites.RegisterSite("tcpipRibbonTools", tcpipRibbonGroup.Tools); InitializeTcpipTools(); snmpRibbonGroup = new RibbonGroup("SNMP"); snmpRibbonGroup.Caption = "SNMP"; snmpRibbonGroup.PreferredToolSize = RibbonToolSize.Large; workItem.UIExtensionSites["discoverRibbonGroups"].Add <RibbonGroup>(snmpRibbonGroup); // Now register the Active Directory group Tools collection workItem.RootWorkItem.UIExtensionSites.RegisterSite("snmpRibbonTools", snmpRibbonGroup.Tools); InitializeSNMPTools(); autoScanRibbonGroup = new RibbonGroup("Auto-Discovery"); autoScanRibbonGroup.Caption = "Auto-Discovery"; autoScanRibbonGroup.PreferredToolSize = RibbonToolSize.Large; workItem.UIExtensionSites["discoverRibbonGroups"].Add <RibbonGroup>(autoScanRibbonGroup); // Now register the Active Directory group Tools collection workItem.RootWorkItem.UIExtensionSites.RegisterSite("autoScanRibbonTools", autoScanRibbonGroup.Tools); InitializeAutoScanTools(); }
public RibbonGroupAutomationPeer(RibbonGroup owner) : base(owner) { }
public void ConstruirGrupoPersonalizado() { RibbonTab Tab = utbmMain.Ribbon.Tabs["Inicio"]; if (m_Acciones.Count > 0) { RibbonGroup Group = null; if (Tab.Groups.Exists("Personalizadas")) { Tab.Groups.Remove("Personalizadas"); } Group = new RibbonGroup("Personalizadas", "Opciones Personalizadas"); foreach (ItemContenedorAccion Item in m_Acciones) { ButtonTool Tool = new ButtonTool(Item.ID); Tool.SharedProps.Caption = Item.Accion.Descripcion; Tool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; Tool.SharedProps.AppearancesLarge.Appearance.Image = ilMain.Images[Item.Accion.Imagen]; Group.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { Tool }); } Tab.Groups.Add(Group); } else { if (Tab.Groups.Exists("Personalizadas")) { Tab.Groups.Remove("Personalizadas"); } } }
public void ConstruirTab() { RibbonTab Tab = new RibbonTab("Inicio", "Inicio"); RibbonGroup Group = new RibbonGroup("Estandar", "Opciones Estándar"); ButtonTool Tool = new ButtonTool("Nuevo"); Tool.SharedProps.Caption = "Nuevo"; Tool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; Tool.SharedProps.AppearancesLarge.Appearance.Image = ilMain.Images["add_page.png"]; Tool.SharedProps.Shortcut = Shortcut.CtrlN; Tool.SharedProps.Enabled = false; Group.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { Tool }); Tool = new ButtonTool("Modificar"); Tool.SharedProps.Caption = "Modificar"; Tool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; Tool.SharedProps.AppearancesLarge.Appearance.Image = ilMain.Images["edit_page.png"]; Tool.SharedProps.Shortcut = Shortcut.CtrlM; Tool.SharedProps.Enabled = false; Group.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { Tool }); Tool = new ButtonTool("Eliminar"); Tool.SharedProps.Caption = "Eliminar"; Tool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; Tool.SharedProps.AppearancesLarge.Appearance.Image = ilMain.Images["delete_page.png"]; Tool.SharedProps.Shortcut = Shortcut.CtrlD; Tool.SharedProps.Enabled = false; Group.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { Tool }); Tool = new ButtonTool("Copiar"); Tool.SharedProps.Caption = "Copiar"; Tool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; Tool.SharedProps.AppearancesLarge.Appearance.Image = ilMain.Images["attachment.png"]; Tool.SharedProps.Shortcut = Shortcut.CtrlC; Tool.SharedProps.Enabled = false; Group.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { Tool }); Tool = new ButtonTool("Auditar"); Tool.SharedProps.Caption = "Auditar"; Tool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; Tool.SharedProps.AppearancesLarge.Appearance.Image = ilMain.Images["search.png"]; Tool.SharedProps.Enabled = false; Group.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { Tool }); Tool = new ButtonTool("Actualizar"); Tool.SharedProps.Caption = "Actualizar"; Tool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; Tool.SharedProps.AppearancesLarge.Appearance.Image = ilMain.Images["refresh.png"]; Tool.SharedProps.Shortcut = Shortcut.F5; Tool.SharedProps.Enabled = false; Group.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { Tool }); Tool = new ButtonTool("ImportarXML"); Tool.SharedProps.Caption = "Importar XML"; Tool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; Tool.SharedProps.AppearancesLarge.Appearance.Image = ilMain.Images["orange_arrow_down.png"]; //Tool.SharedProps.Shortcut = Shortcut.F5; Tool.SharedProps.Enabled = false; Group.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { Tool }); Tool = new ButtonTool("ExportarXML"); Tool.SharedProps.Caption = "Exportar XML"; Tool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; Tool.SharedProps.AppearancesLarge.Appearance.Image = ilMain.Images["orange_arrow_up.png"]; //Tool.SharedProps.Shortcut = Shortcut.F5; Tool.SharedProps.Enabled = false; Group.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { Tool }); Tab.Groups.Add(Group); utbmMain.Ribbon.Tabs.Add(Tab); }
private void CreateRibbonBar() { RibbonBar ribbonBar = axCommandBars.AddRibbonBar("DemoSoft Team Ribbon"); ribbonBar.EnableDocking(XTPToolBarFlags.xtpFlagStretched); // 系统菜单 CommandBarPopup popupSystem = ribbonBar.AddSystemButton(); popupSystem.IconId = ResourceId.ID_SYSTEM_ICON; popupSystem.CommandBar.Controls.Add(XTPControlType.xtpControlButton, ResourceId.ID_CONFIG_UTMR_DTMS, "配置(&P)", false, false); CommandBarControl controlSystem = popupSystem.CommandBar.Controls.Add(XTPControlType.xtpControlButton, ResourceId.ID_APP_HIDE, "退出(&E)", false, false); controlSystem.BeginGroup = true; popupSystem.CommandBar.SetIconSize(32, 32); // 关于菜单 CommandBarControl controlAbout = ribbonBar.Controls.Add(XTPControlType.xtpControlButton, ResourceId.ID_APP_ABOUT, "关于(&A)", false, false); controlAbout.Flags = XTPControlFlags.xtpFlagRightAlign; // 主页 RibbonTab primarySR = ribbonBar.InsertTab(0, "主页(&H)"); primarySR.Id = ResourceId.ID_UTMR_DTMS; // 主页 -> 配置 RibbonGroup groupConfig = primarySR.Groups.AddGroup("配置(&C)", ResourceId.ID_CONFIG_BUILD); CommandBarControl controlConfigApp = groupConfig.Add(XTPControlType.xtpControlButton, ResourceId.ID_CONFIG_UTMR_DTMS, "配置策略(&O)", false, false); // 主页 -> UTMR-DTMS生成 RibbonGroup groupPrimaryStockBuild = primarySR.Groups.AddGroup("UTMR-DTMS生成(&F)", ResourceId.ID_UTMR_DTMS_BUILD); CommandBarControl controlBuildPrimaryReportS = groupPrimaryStockBuild.Add(XTPControlType.xtpControlButton, ResourceId.ID_BUILD_UTMR_DTMS, "生成UTMR-DTMS报表(&T)", false, false); // 主页 -> UTMR-DTMS报表 RibbonGroup groupPrimaryStockReport = primarySR.Groups.AddGroup("UTMR-DTMS报表(&F)", ResourceId.ID_UTMR_DTMS_REPORT); CommandBarControl controlOpenPrimaryReportS = groupPrimaryStockReport.Add(XTPControlType.xtpControlButton, ResourceId.ID_REPORT_UTMR, "显示UTMR报表(&S)", false, false); CommandBarControl controlOpenPrimaryReportD = groupPrimaryStockReport.Add(XTPControlType.xtpControlButton, ResourceId.ID_REPORT_DTMS, "显示DTMS报表(&M)", false, false); // 视图 RibbonTab tabView = ribbonBar.InsertTab(3, "视图(&V)"); tabView.Id = ResourceId.ID_TAB_VIEW; // 视图 -> 报表 RibbonGroup groupShow = tabView.Groups.AddGroup("报表(&D)", ResourceId.ID_GROUP_SHOW); CommandBarControl controlWorkspace = groupShow.Add(XTPControlType.xtpControlCheckBox, ResourceId.ID_SHOW_WORKSPACE, "工作区(&W)", false, false); controlWorkspace.Checked = true; groupShow.Add(XTPControlType.xtpControlCheckBox, ResourceId.ID_SHOW_STATUS, "状态栏(&S)", false, false); // 工具 RibbonTab tabTools = ribbonBar.InsertTab(4, "工具(&T)"); tabTools.Id = ResourceId.ID_TAB_TOOLS; // 工具 -> 内部工具 RibbonGroup groupTools = tabTools.Groups.AddGroup("内部工具(&I)", ResourceId.ID_GROUP_TOOLS); // Welcome To DemoSoft Team ribbonBar.QuickAccessControls.Add(XTPControlType.xtpControlButton, ResourceId.ID_WELCOME, "SR", false, false); ribbonBar.QuickAccessControls.Add(XTPControlType.xtpControlButton, ResourceId.ID_TO, "Trading", false, false); ribbonBar.QuickAccessControls.Add(XTPControlType.xtpControlButton, ResourceId.ID_DEMO_SOFT, "Wizard", false, false); //ribbonBar.QuickAccessControls.Add( XTPControlType.xtpControlButton, ResourceId.ID_TEAM, "Team", false, false ); }
protected override void OnNavigatedTo(Windows.UI.Xaml.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); if (viewerControl == null) { viewerControl = new StiViewerControl(); #region Add Button if (viewerControl.ToolbarPanel != null) { var stackPanel = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(8, 0, 8, 0) }; var demoButton = new RibbonButton { VerticalAlignment = VerticalAlignment.Center, MinWidth = 75, Height = 92, Content = CreateButtonContent(ref demoButtonLabel, StiLocalization.Get("NavigatorRT", "ReportsDemo"), "ms-appx:///Images/Home.png") }; demoButton.Click += DemoButtonClick; var addReportButton = new RibbonButton { VerticalAlignment = VerticalAlignment.Center, MinWidth = 75, Height = 92, Content = CreateButtonContent(ref demoButtonLabel, StiLocalization.Get("NavigatorRT", "AddCustomReports"), "ms-appx:///Images/AddCustomReport.png") }; addReportButton.Click += AddReportButtonClick; stackPanel.Children.Add(demoButton); stackPanel.Children.Add(addReportButton); groupDemo = new RibbonGroup { Header = StiLocalization.Get("NavigatorRT", "Demo"), Content = stackPanel }; viewerControl.ToolbarPanel.Children.Insert(0, groupDemo); } #endregion } else { if (viewerControl.Parent != null) { ((Grid)viewerControl.Parent).Children.Remove(viewerControl); } } var currentReport = e.Parameter as StiReport; gridRoot.Children.Add(viewerControl); viewerControl.Report = currentReport; StiLocalization.LocalizationChanged += ThisLocalizationChanged; }
void createBodyInstructorRibbon(Ribbon ribbon) { var mainRibbonTab = EnumLocalizer.Default.GetUIString("BodyArchitect.Client.Module.Instructor:InstructorStrings:InstructorModule_createBodyInstructorRibbon_TabName"); if (ribbon.Items.Cast <RibbonTab>().Where(x => x.Name == mainRibbonTab).Count() > 0) { return; } RibbonTab tab = new RibbonTab(); tab.Name = mainRibbonTab; tab.Header = "ModuleName".TranslateInstructor(); ribbon.Items.Add(tab); RibbonGroup ribbonGroup = new RibbonGroup(); ribbonGroup.Header = EnumLocalizer.Default.GetUIString("BodyArchitect.Client.Module.Instructor:InstructorStrings:InstructorModule_createBodyInstructorRibbon_RibbonHeader_Catalogs"); tab.Items.Add(ribbonGroup); RibbonGroup customersGroup = new RibbonGroup(); customersGroup.Header = EnumLocalizer.Default.GetUIString("BodyArchitect.Client.Module.Instructor:InstructorStrings:InstructorModule_createBodyInstructorRibbon_CustomerHeader_Customers"); tab.Items.Add(customersGroup); var button = new RibbonButton(); button.Label = EnumLocalizer.Default.GetUIString("BodyArchitect.Client.Module.Instructor:InstructorStrings:InstructorModule_createBodyInstructorRibbon_ButtonLabel_Activities"); button.LargeImageSource = "pack://application:,,,/BodyArchitect.Client.Module.Instructor;component/Images/Activity32.png".ToBitmap(); button.SmallImageSource = "pack://application:,,,/BodyArchitect.Client.Module.Instructor;component/Images/Activity16.png".ToBitmap(); button.Click += new System.Windows.RoutedEventHandler(button_Click); ribbonGroup.Items.Add(button); var rbtnScheduleEntries = new RibbonButton(); rbtnScheduleEntries.Label = EnumLocalizer.Default.GetUIString("BodyArchitect.Client.Module.Instructor:InstructorStrings:InstructorModule_createBodyInstructorRibbon_ScheduleEntries_Label_Sheduler"); rbtnScheduleEntries.LargeImageSource = "pack://application:,,,/BodyArchitect.Client.Module.Instructor;component/Images/ScheduleEntries.png".ToBitmap(); rbtnScheduleEntries.Click += new RoutedEventHandler(rbtnScheduleEntries_Click); ribbonGroup.Items.Add(rbtnScheduleEntries); var rbtnCustomers = new RibbonButton(); rbtnCustomers.Label = EnumLocalizer.Default.GetUIString("BodyArchitect.Client.Module.Instructor:InstructorStrings:InstructorModule_createBodyInstructorRibbon_Customers_Label_Customers"); rbtnCustomers.LargeImageSource = "pack://application:,,,/BodyArchitect.Client.Module.Instructor;component/Images/Customer32.png".ToBitmap(); rbtnCustomers.SmallImageSource = "pack://application:,,,/BodyArchitect.Client.Module.Instructor;component/Images/Customer16.png".ToBitmap(); rbtnCustomers.Click += new RoutedEventHandler(rbtnCustomers_Click); customersGroup.Items.Add(rbtnCustomers); var rbtnCustomerGroups = new RibbonButton(); rbtnCustomerGroups.Label = EnumLocalizer.Default.GetUIString("BodyArchitect.Client.Module.Instructor:InstructorStrings:InstructorModule_createBodyInstructorRibbon_CustomerGroups_Label_Groups"); rbtnCustomerGroups.LargeImageSource = "pack://application:,,,/BodyArchitect.Client.Module.Instructor;component/Images/CustomerGroup32.png".ToBitmap(); rbtnCustomerGroups.SmallImageSource = "pack://application:,,,/BodyArchitect.Client.Module.Instructor;component/Images/CustomerGroup16.png".ToBitmap(); rbtnCustomerGroups.Click += new RoutedEventHandler(rbtnCustomerGroups_Click); customersGroup.Items.Add(rbtnCustomerGroups); var rbtnChampionships = new RibbonButton(); rbtnChampionships.Label = EnumLocalizer.Default.GetUIString("BodyArchitect.Client.Module.Instructor:InstructorStrings:ChampionshipsView_Header"); rbtnChampionships.LargeImageSource = "pack://application:,,,/BodyArchitect.Client.Module.Instructor;component/Images/Championship32.png".ToBitmap(); rbtnChampionships.SmallImageSource = "pack://application:,,,/BodyArchitect.Client.Module.Instructor;component/Images/Championship16.png".ToBitmap(); rbtnChampionships.Click += new RoutedEventHandler(rbtnChampionships_Click); customersGroup.Items.Add(rbtnChampionships); var rbtnReminders = new RibbonButton(); rbtnReminders.Label = EnumLocalizer.Default.GetUIString("BodyArchitect.Client.Module.Instructor:InstructorStrings:InstructorModule_createBodyInstructorRibbon_Reminders_Label_Reminders"); rbtnReminders.LargeImageSource = "pack://application:,,,/BodyArchitect.Client.Resources;component/Images/Reminder32.png".ToBitmap(); rbtnReminders.SmallImageSource = "pack://application:,,,/BodyArchitect.Client.Resources;component/Images/Reminder16.png".ToBitmap(); rbtnReminders.Click += new RoutedEventHandler(rbtnReminders_Click); customersGroup.Items.Add(rbtnReminders); }
//-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /// <summary> /// Called to initialize the extension. /// </summary> /// <param name="host">WebMatrix host interface.</param> /// <param name="initData">Extension initialization data.</param> protected override void Initialize(IWebMatrixHost host, ExtensionInitData initData) { _webMatrixHost = host; _webMatrixHost.WebSiteChanged += webMatrixHost_WebSiteChanged; // create a new ribbon button group that contains the get version button _ribbonGroup = new RibbonGroup( "NumediaStack", new RibbonItem[] { new RibbonButton( "Get Version", new DelegateCommand(HandleGetVersion), null, _starImageSmall, _starImageLarge) }); // create a new contextual ribbon tab that will only show up for Numedia Stack _contextualTab = new RibbonContextualTab("Numedia Stack Tools", new RibbonItem[] { _ribbonGroup }); }
public SBplugin(MainWindow mainWindow) { this.mainWindow = mainWindow; try { bool bCreated = false; RibbonTab tab = new RibbonTab() { Header = "Plugins", KeyTip = "P" }; string path = mainWindow.exeFolder + "\\plugins"; if (!Directory.Exists(path)) { return; } string[] dlls = Directory.GetFiles(path, "*.dll"); foreach (string dll in dlls) { Assembly assembly = Assembly.LoadFrom(dll); RibbonGroup group = new RibbonGroup() { Header = Path.GetFileNameWithoutExtension(path) }; tab.Items.Add(group); Type[] types = assembly.GetTypes(); foreach (Type type in types) { if (type.IsPublic && type.IsDefined(typeof(SBpluginAttribute), false)) { if (null != GetValue(type, "GetGroupName")) { group.Header = (string)GetValue(type, "GetGroupName"); } Plugin plugin = new Plugin(mainWindow); plugins.Add(plugin); plugin.type = type; if (null != GetValue(type, "GetName")) { plugin.name = (string)GetValue(type, "GetName"); } if (null != GetValue(type, "GetBitmap")) { plugin.bitmap = (Bitmap)GetValue(type, "GetBitmap"); } if (null != GetValue(type, "LargeButton")) { plugin.largeButton = (bool)GetValue(type, "LargeButton"); } if (null != GetValue(type, "GetToolTip")) { plugin.tooltip = (string)GetValue(type, "GetToolTip"); } MethodInfo[] methods = type.GetMethods(BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Static); foreach (MethodInfo method in methods) { ParameterInfo[] args = method.GetParameters(); if (args.Length == 1 && args[0].ParameterType == typeof(string)) { plugin.runText = method; } if (args.Length == 1 && args[0].ParameterType == typeof(MainWindow)) { plugin.runMainWindow = method; } } if (plugin.name != "" && (null != plugin.runText || null != plugin.runMainWindow)) { if (!bCreated) { mainWindow.ribbon.Items.Add(tab); } bCreated = true; RibbonButton button = new RibbonButton() { Label = plugin.name }; if (plugin.tooltip != "") { button.ToolTip = plugin.tooltip; } if (plugin.largeButton) { button.LargeImageSource = MainWindow.ImageSourceFromBitmap(plugin.bitmap); } else { button.SmallImageSource = MainWindow.ImageSourceFromBitmap(plugin.bitmap); } group.Items.Add(button); button.Click += new RoutedEventHandler(pluginClick); button.Tag = plugin; } else { MainWindow.Errors.Add(new Error("Plugin Add : Failed to add a plugin in group " + group.Header)); } } } } } catch (Exception ex) { MainWindow.Errors.Add(new Error("Plugin Add : " + ex.Message)); } }
protected void SetupRibbon() { ASPxRibbon ribbon = new ASPxRibbon(); RibbonTab tab = new RibbonTab(); RibbonGroup editingGroup = new RibbonGroup(); editingGroup.Name = "Tools"; editingGroup.Text = "Tools"; editingGroup.Items.Add(RibbonButtonItem("Import", "Import from CSV", RibbonItemSize.Large, IconImage.Import_Large, UrlManager.PhonebooksImportDataByPhonebookId(phonebook.Oid), HelpText.ImportFromCSVDescription)); tab.Groups.Add(editingGroup); ribbon.Tabs.Add(tab); ribbon.ShowTabs = false; ShowRibbon(ribbon); }
/// <summary> /// Method which finds the next group to /// increase size of and increases it. /// </summary> internal bool IncreaseNextGroupSize() { RibbonGroup nextGroup = null; return(IncreaseNextGroupSize(true, out nextGroup)); }
public static string header(this RibbonGroup ribonGroup) { return((string)ribonGroup.wpfInvoke( () => { return ribonGroup.Header; })); }
/// <summary> /// If the application developer has specified a GroupSizeReductionOrder, this /// takes the next group in that order and tells it to increase to its next size. /// If no GroupSizeReductionOrder was specified, or if we collapsed RibbonGroups /// beyond what was specified by the developer, we expand groups in reverse order /// of their reduction. /// </summary> /// <returns>True if a group was able to be expanded in size, false otherwise.</returns> private bool IncreaseNextGroupSize(bool update, out RibbonGroup nextRibbonGroup) { nextRibbonGroup = null; bool resizeSuccessful = false; int automaticResizeOrderCount = _automaticResizeOrder.Count; while (automaticResizeOrderCount > 0 && !resizeSuccessful) { int nextGroupIndex = _automaticResizeOrder[automaticResizeOrderCount - 1]; nextRibbonGroup = ItemContainerGenerator.ContainerFromIndex(nextGroupIndex) as RibbonGroup; if (nextRibbonGroup != null) { resizeSuccessful = nextRibbonGroup.IncreaseGroupSize(update); } if (update) { _automaticResizeOrder.RemoveAt(automaticResizeOrderCount - 1); _groupAutoResizeIndex = nextGroupIndex; } automaticResizeOrderCount--; } if (!resizeSuccessful) { if (GroupSizeReductionOrder != null && _groupReduceOrderLocation >= 0) { int groupReduceOrderLocation = _groupReduceOrderLocation; int resizeStatusCount = _groupReductionResizeStatus.Count; while (groupReduceOrderLocation >= 0 && !resizeSuccessful) { Debug.Assert(resizeStatusCount > 0); bool wasResizeSuccessful = _groupReductionResizeStatus[resizeStatusCount - 1]; if (update) { _groupReductionResizeStatus.RemoveAt(resizeStatusCount - 1); } resizeStatusCount--; if (!wasResizeSuccessful) { groupReduceOrderLocation--; continue; } // Find the RibbonGroup whose name is specified next in the GroupSizeReductionOrder. nextRibbonGroup = FindRibbonGroupWithName(GroupSizeReductionOrder[groupReduceOrderLocation--]); if (nextRibbonGroup == null) { resizeSuccessful = false; } else { // A group was found, tell it to increase its size. resizeSuccessful = nextRibbonGroup.IncreaseGroupSize(update); } } if (update) { _groupReduceOrderLocation = groupReduceOrderLocation; } } } if (!resizeSuccessful) { nextRibbonGroup = null; } return(resizeSuccessful); }
private void setupWindowTab() { var btEditorWindow = new ButtonTool("btEditorWindow"); btEditorWindow.SharedProps.Caption = "Editor"; var btSearchWindow = new ButtonTool("btSearchWindow"); btSearchWindow.SharedProps.Caption = "Search"; var btTableUsageWindow = new ButtonTool("btTableUsageWindow"); btTableUsageWindow.SharedProps.Caption = "Table Usage"; _view.tbManager.Tools.Add(btEditorWindow); _view.tbManager.Tools.Add(btSearchWindow); _view.tbManager.Tools.Add(btTableUsageWindow); var rtWindows = new RibbonTab("rtWindows", "Windows"); var rgWindows = new RibbonGroup("rgWindows", "Windows"); rgWindows.Tools.Add(btEditorWindow); rgWindows.Tools.Add(btSearchWindow); rgWindows.Tools.Add(btTableUsageWindow); rtWindows.Groups.Add(rgWindows); _view.tbManager.Ribbon.Tabs.Add(rtWindows); // Pane group var btFilePane = new ButtonTool("btFilePane"); btFilePane.SharedProps.Caption = "Files"; var btDatabasePane = new ButtonTool("btDatabasePane"); btDatabasePane.SharedProps.Caption = "Database"; _view.tbManager.Tools.Add(btFilePane); _view.tbManager.Tools.Add(btDatabasePane); var rgPanes = new RibbonGroup("rgPanes", "Panes"); rgPanes.Tools.Add(btFilePane); rgPanes.Tools.Add(btDatabasePane); rtWindows.Groups.Add(rgPanes); // Options group var btSaveOptions = new ButtonTool("btSaveOptions"); btSaveOptions.SharedProps.Caption = "Save"; var btLoadOptions = new ButtonTool("btLoadOptions"); btLoadOptions.SharedProps.Caption = "Load"; _view.tbManager.Tools.Add(btSaveOptions); _view.tbManager.Tools.Add(btLoadOptions); var rgOptions = new RibbonGroup("rgOptions", "Options"); rgOptions.Tools.Add(btSaveOptions); rgOptions.Tools.Add(btLoadOptions); rtWindows.Groups.Add(rgOptions); // Themes group var btLoadTheme = new ButtonTool("btLoadTheme"); btLoadTheme.SharedProps.Caption = "Load"; _view.tbManager.Tools.Add(btLoadTheme); var rgThemes = new RibbonGroup("rgThemes", "Themes"); rgThemes.Tools.Add(btLoadTheme); rtWindows.Groups.Add(rgThemes); }
private void setupViewUspUdfTab() { var btOpenView = new ButtonTool("btOpenView"); btOpenView.SharedProps.Caption = "Open View"; btOpenView.SharedProps.AppearancesSmall.Appearance.Image = 7; var btEditView = new ButtonTool("btEditView"); btEditView.SharedProps.Caption = "Edit View"; btEditView.SharedProps.AppearancesSmall.Appearance.Image = 7; _view.tbManager.Tools.Add(btOpenView); _view.tbManager.Tools.Add(btEditView); var rtView = new RibbonTab("rtView", "View, USP, UDF"); var rgView = new RibbonGroup("rgView", "View"); rgView.Tools.Add(btOpenView); rgView.Tools.Add(btEditView); rtView.Groups.Add(rgView); _view.tbManager.Ribbon.Tabs.Add(rtView); // USP group var btExecUsp = new ButtonTool("btExecUsp"); btExecUsp.SharedProps.Caption = "Exec USP"; var btEditUsp = new ButtonTool("btEditUsp"); btEditUsp.SharedProps.Caption = "Edit USP"; _view.tbManager.Tools.Add(btExecUsp); _view.tbManager.Tools.Add(btEditUsp); var rgPanes = new RibbonGroup("rgUsp", "USP"); rgPanes.Tools.Add(btExecUsp); rgPanes.Tools.Add(btEditUsp); rtView.Groups.Add(rgPanes); // UDF group var btExecUdf = new ButtonTool("btExecUdf"); btExecUdf.SharedProps.Caption = "Exec UDF"; var btEditUdf = new ButtonTool("btEditUdf"); btEditUdf.SharedProps.Caption = "Edit UDF"; _view.tbManager.Tools.Add(btExecUdf); _view.tbManager.Tools.Add(btEditUdf); var rgUdf = new RibbonGroup("rgUdf", "UDF"); rgUdf.Tools.Add(btExecUdf); rgUdf.Tools.Add(btEditUdf); rtView.Groups.Add(rgUdf); }
/// <summary> /// If the application developer has specified a GroupSizeReductionOrder, this /// takes the next group in that order and tells it to increase to its next size. /// If no GroupSizeReductionOrder was specified, or if we collapsed RibbonGroups /// beyond what was specified by the developer, we expand groups in reverse order /// of their reduction. /// </summary> /// <returns>True if a group was able to be expanded in size, false otherwise.</returns> private bool IncreaseNextGroupSize(bool update, out RibbonGroup nextRibbonGroup) { nextRibbonGroup = null; bool resizeSuccessful = false; int automaticResizeOrderCount = _automaticResizeOrder.Count; while (automaticResizeOrderCount > 0 && !resizeSuccessful) { int nextGroupIndex = _automaticResizeOrder[automaticResizeOrderCount - 1]; nextRibbonGroup = ItemContainerGenerator.ContainerFromIndex(nextGroupIndex) as RibbonGroup; if (nextRibbonGroup != null) { resizeSuccessful = nextRibbonGroup.IncreaseGroupSize(update); } if (update) { _automaticResizeOrder.RemoveAt(automaticResizeOrderCount - 1); _groupAutoResizeIndex = nextGroupIndex; } automaticResizeOrderCount--; } if (!resizeSuccessful) { if (GroupSizeReductionOrder != null && _groupReduceOrderLocation >= 0) { int groupReduceOrderLocation = _groupReduceOrderLocation; int resizeStatusCount = _groupReductionResizeStatus.Count; while (groupReduceOrderLocation >= 0 && !resizeSuccessful) { Debug.Assert(resizeStatusCount > 0); bool wasResizeSuccessful = _groupReductionResizeStatus[resizeStatusCount - 1]; if (update) { _groupReductionResizeStatus.RemoveAt(resizeStatusCount - 1); } resizeStatusCount--; if (!wasResizeSuccessful) { groupReduceOrderLocation--; continue; } // Find the RibbonGroup whose name is specified next in the GroupSizeReductionOrder. nextRibbonGroup = FindRibbonGroupWithName(GroupSizeReductionOrder[groupReduceOrderLocation--]); if (nextRibbonGroup == null) { resizeSuccessful = false; } else { // A group was found, tell it to increase its size. resizeSuccessful = nextRibbonGroup.IncreaseGroupSize(update); } } if (update) { _groupReduceOrderLocation = groupReduceOrderLocation; } } } if (!resizeSuccessful) { nextRibbonGroup = null; } return resizeSuccessful; }
/// <summary> /// Addinhoz létrehozott RibbonTabhoz adja az adott modul ModuleRibbonGroup függvényében /// implementált vezérlőket. Meghívása ModuleHandler.LoadModules-on keresztül ExcelRibbon.cs konstruktorban /// történik (Ribbon init után nem lehet a ribbonhoz elemeket adni) /// </summary> /// <param name="MyRibbon"></param> /// <param name="MyRibbonTab"></param> public void AddRibbonControls(RibbonBase MyRibbon, RibbonTab MyRibbonTab) { RibbonGroup myGroup = ModuleRibbonGroup(MyRibbon, MyRibbonTab); if (myGroup != null) { _MyRibbonGroup = myGroup; _MyRibbonTab = MyRibbonTab; _MyRibbonTab.Groups.Add(myGroup); } }
/// <summary> /// Create the starting tab for the ribbon in the sample /// </summary> private void createModuloTab(ModuloDTO modulo) { try { // by default the caption of the ribbon is initialized to the key // so the key and text in this tab will be 'Home' // note: the following two lines are equivalent to: // var moduloTab = new RibbonTab(modulo.Descrizione); ultraToolbarsManager1.Ribbon.Tabs.Add(moduloTab); moduloTab.MergeOrder = 1; moduloTab.Tag = modulo; // =============== // Plugins Group // =============== foreach (var gruppo in modulo.Gruppi) { try { // create a ribbon group that will contain the clipboard tools // note, the following is another way to perform this action: // //RibbonGroup groupClipboard = homeTab.Groups.Add("Clipboard"); var groupPlugin = new RibbonGroup(gruppo.NomeAssembly) { Caption = gruppo.Descrizione, LayoutDirection = RibbonGroupToolLayoutDirection.Vertical, PreferredToolSize = RibbonToolSize.Large }; moduloTab.Groups.Add(groupPlugin); // ===================================================== // Voci di menu // ===================================================== var listaPlugin = _pluginManager.GetPluginListForInterface(gruppo.NomeAssembly).Select(plugin => _pluginManager.CreateInstance<IPlugin<CondominioDTO>>(plugin)).ToList(); foreach (var pluginInstance in listaPlugin.OrderBy(item => item.Order)) { try { // Recupero le eventuali opzioni della singola voce var voce = (gruppo.VociMenu.Where(item => item.VoceKey == pluginInstance.Key)).SingleOrDefault(); if (pluginInstance.Key != "CompilazionePDF") { ToolBase pluginTool = createButtonTool(pluginInstance.Key, pluginInstance.Caption, pluginInstance.SmallIcon, pluginInstance.LargeIcon); pluginTool = addPluginTool(groupPlugin, pluginInstance.Key, voce, pluginInstance.LargeIcon, pluginInstance.SmallIcon); } if (pluginInstance.OrderNew > -1) { //createButtonTool(pluginInstance.KeyNew, pluginInstance.CaptionNew, pluginInstance.LargeIconNew, pluginInstance.LargeIconNew); //ToolBase pluginNewTool = groupPlugin.Tools.AddTool(pluginInstance.KeyNew); //_pluginList.Add(pluginInstance.KeyNew, pluginInstance); voce = (gruppo.VociMenu.Where(item => item.VoceKey == pluginInstance.KeyNew)).SingleOrDefault(); ToolBase pluginNewTool = createButtonTool(pluginInstance.KeyNew, pluginInstance.CaptionNew, pluginInstance.SmallIconNew, pluginInstance.LargeIconNew); pluginNewTool = addPluginTool(groupPlugin, pluginInstance.KeyNew, voce, pluginInstance.LargeIconNew, pluginInstance.SmallIconNew); pluginNewTool.Tag = "NEW"; _pluginList.Add(pluginInstance.KeyNew, pluginInstance); } _pluginList.Add(pluginInstance.Key, pluginInstance); var instance = pluginInstance as ICambioEsercizioContabilita; if (instance != null) instance.UpdateEsercizi += mdiSferaUpdateEsercizi; var updateCondominio = pluginInstance as IUpdateCondominio; if (updateCondominio != null) { foreach(var kvp in _pluginList) { var condominio = kvp.Value as IUpdateCondominio; if (condominio != null) condominio.ReloadData(); } updateCondominio.UpdateCondominio += mdiSferaUpdateCondominio; } } catch (Exception ex) { _log.ErrorFormat("Errore inaspettato durante il caricamento dei plugins (Singolo Plugin) - {0} - plugin:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), pluginInstance.Key, Login.Instance.CurrentLogin().Azienda); MessageBox.Show(@"Errore inaspettato durante il caricamento dei plugins (Singolo Plugin) - " + Utility.GetMethodDescription() + @" - plugin:" + pluginInstance.Key); throw; } } if (groupPlugin.Tools.Count > 0) groupPlugin.Settings.CollapsedAppearance.Image = groupPlugin.Tools[0].SharedProps.AppearancesLarge.Appearance.Image; } catch (Exception ex) { _log.ErrorFormat("Errore inaspettato durante il caricamento dei plugins (Gruppo di plugin) - {0} - gruppo:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), gruppo.Descrizione, Login.Instance.CurrentLogin().Azienda); MessageBox.Show(@"Errore inaspettato durante il caricamento dei plugins (Gruppo di plugin) - " + Utility.GetMethodDescription() + @" - gruppo:" + gruppo.Descrizione + @" - assembly:" + gruppo.NomeAssembly); throw; } } } catch (Exception ex) { _log.ErrorFormat("Errore inaspettato durante il caricamento dei plugins (Modulo) - {0} - modulo:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), ex, modulo.Descrizione, Login.Instance.CurrentLogin().Azienda); MessageBox.Show(@"Errore inaspettato durante il caricamento dei plugins (Modulo) - " + Utility.GetMethodDescription() + @" - modulo:" + modulo.Descrizione); throw; } }
//-------------------------------------------------------------------------- // // Event Handlers // //-------------------------------------------------------------------------- #region Initialize /// <summary> /// Called when the WebMatrixHost property changes. /// </summary> /// <param name="Host">Host used to communicate with WebMatrix</param> protected override void Initialize(IWebMatrixHost host, ExtensionInitData data) { // Get new values _host = host; if (host != null) { host.WorkspaceChanged += new EventHandler<WorkspaceChangedEventArgs>(WebMatrixHost_WorkspaceChanged); host.WebSiteChanged += new EventHandler<EventArgs>(WebMatrixHost_WebSiteChanged); // Add a simple button to the Ribbon _ribbonGroup = new RibbonGroup( "Node", new RibbonItem[] { new RibbonButton( "Debug", _launchDebuggerCommand, null, _starImageSmall, _starImageLarge) }); data.RibbonItems.Add(_ribbonGroup); _editorTaskPanel.PageChanged += InitializeLogTab; // handle the right click event the tree host.ContextMenuOpening += new EventHandler<ContextMenuOpeningEventArgs>(host_ContextMenuOpening); // if this is the first time the extension is installed, this method will be called if (_host.WebSite != null && !String.IsNullOrEmpty(_host.WebSite.Path)) { _isNodeSite = IsNodeProject(); _ribbonGroup.IsVisible = _host.Workspace is IEditorWorkspace && _isNodeSite; InitializeLogTab(this, EventArgs.Empty); } InstallNodeInspector(); } }
/// <summary> /// Allocation algorithm for star values. /// </summary> private double AllocateStarValues(RibbonGroup ribbonGroup, double remainingSpace) { List<StarLayoutInfo> starInfoList = new List<StarLayoutInfo>(2); List<IProvideStarLayoutInfo> starLayoutInfoProviders = new List<IProvideStarLayoutInfo>(2); // creates a list of appropriate candidates for star allocation foreach (IProvideStarLayoutInfo starLayoutInfoProvider in _registeredStarLayoutProviders) { bool considerForAllocation = ((ribbonGroup == null && starLayoutInfoProvider.TargetElement is RibbonGroup) || ribbonGroup == starLayoutInfoProvider.TargetElement); bool added = false; IEnumerable<StarLayoutInfo> starLayoutCombinations = starLayoutInfoProvider.StarLayoutCombinations; if (starLayoutCombinations != null) { foreach (StarLayoutInfo starLayoutInfo in starLayoutCombinations) { if (starLayoutInfo != null && DoubleUtil.GreaterThan(starLayoutInfo.RequestedStarWeight, 0)) { starLayoutInfo.AllocatedStarWidth = starLayoutInfo.RequestedStarMinWidth; if (considerForAllocation) { added = true; starInfoList.Add(starLayoutInfo); } } } } if (added) { starLayoutInfoProviders.Add(starLayoutInfoProvider); } } if (DoubleUtil.GreaterThan(remainingSpace, 0)) { // Tries to equalize the perstarspace of star element // constrained by their min/max constraints and available space. starInfoList.Sort(StarLayoutInfo.PerStarValueComparer); int rightMostEqualizerIndex = -1; EqualizeStarValues(starInfoList, ref remainingSpace, out rightMostEqualizerIndex); // Distributes the remaining space after step 1 equally among all the // qualified member, such that they are constrained by their min/max constraints // maintaining (but not necessarily attaining) the goal of making perstarvalue of // all the elements as equal as possible. if (rightMostEqualizerIndex >= 0 && DoubleUtil.GreaterThan(remainingSpace, 0)) { starInfoList.Sort(0, rightMostEqualizerIndex + 1, StarLayoutInfo.PotentialPerStarValueComparer); DistributeRemainingSpace(starInfoList, (rightMostEqualizerIndex + 1), ref remainingSpace); } } foreach (IProvideStarLayoutInfo starLayoutInfoProvider in starLayoutInfoProviders) { starLayoutInfoProvider.OnStarSizeAllocationCompleted(); } return remainingSpace; }
protected void SetupRibbon() { ASPxRibbon ribbon = new ASPxRibbon(); RibbonTab tab = new RibbonTab(); RibbonGroup editingGroup = new RibbonGroup(); editingGroup.Name = "Editing"; editingGroup.Text = "Editing"; RibbonButtonItem saveItem = new RibbonButtonItem { Name = "Save", Text = "Save", Size = RibbonItemSize.Large, ToolTip = "Save (NB: This will require emails to be re-sent)" }; saveItem.LargeImage.IconID = IconImage.Save_Large; editingGroup.Items.Add(saveItem); if (importTaskConfiguration != null) { if (importTaskConfiguration.Oid != Guid.Empty) { RibbonButtonItem deleteItem = new RibbonButtonItem { Name = "Delete", Text = "Delete", Size = RibbonItemSize.Large }; deleteItem.LargeImage.IconID = IconImage.Delete_Large; editingGroup.Items.Add(deleteItem); RibbonButtonItem newItem = new RibbonButtonItem { Name = "New", Text = "New", Size = RibbonItemSize.Small, NavigateUrl = UrlManager.ImportTaskConfigurationSaveWithOid(Guid.Empty), }; newItem.SmallImage.IconID = IconImage.New_Small; editingGroup.Items.Add(newItem); } } tab.Groups.Add(editingGroup); ribbon.Tabs.Add(tab); ribbon.ShowTabs = false; ShowRibbon(ribbon); }
private void initializeComponent() { components = new Container(); var buttonTool9 = new ButtonTool("cmdOpen"); var buttonTool10 = new ButtonTool("cmdSave"); var buttonTool11 = new ButtonTool("cmdClose"); var buttonTool12 = new ButtonTool("cmdExit"); var ribbonTab1 = new RibbonTab("tabMain"); var ribbonGroup1 = new RibbonGroup("ribbonGroup1"); var buttonTool1 = new ButtonTool("cmdOpen"); var buttonTool2 = new ButtonTool("cmdSave"); var buttonTool3 = new ButtonTool("cmdClose"); var buttonTool4 = new ButtonTool("cmdOpen"); var appearance1 = new Appearance(); var appearance2 = new Appearance(); var buttonTool5 = new ButtonTool("cmdSave"); var appearance3 = new Appearance(); var appearance4 = new Appearance(); var buttonTool6 = new ButtonTool("cmdClose"); var appearance5 = new Appearance(); var appearance6 = new Appearance(); var buttonTool8 = new ButtonTool("cmdExit"); var resources = new ComponentResourceManager(typeof(FrmMain)); ultraToolbarsManager = new UltraToolbarsManager(components); _frmMain_Toolbars_Dock_Area_Left = new UltraToolbarsDockArea(); _frmMain_Toolbars_Dock_Area_Right = new UltraToolbarsDockArea(); _frmMain_Toolbars_Dock_Area_Top = new UltraToolbarsDockArea(); _frmMain_Toolbars_Dock_Area_Bottom = new UltraToolbarsDockArea(); openFileDialog = new OpenFileDialog(); ((ISupportInitialize)(ultraToolbarsManager)).BeginInit(); SuspendLayout(); // // ultraToolbarsManager // ultraToolbarsManager.DesignerFlags = 0; ultraToolbarsManager.DockWithinContainer = this; ultraToolbarsManager.DockWithinContainerBaseType = typeof(Form); ultraToolbarsManager.FormDisplayStyle = FormDisplayStyle.StandardWithRibbon; buttonTool11.InstanceProps.IsFirstInGroup = true; buttonTool12.InstanceProps.IsFirstInGroup = true; ultraToolbarsManager.Ribbon.ApplicationMenu.ToolAreaLeft.NonInheritedTools.AddRange(new ToolBase[] { buttonTool9, buttonTool10, buttonTool11, buttonTool12}); ultraToolbarsManager.Ribbon.ApplicationMenuButtonImage = Resources.sfera_trasparente; ribbonTab1.Caption = @"Assemblea Offline"; ribbonGroup1.Caption = @"Generale"; buttonTool1.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; buttonTool2.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; buttonTool3.InstanceProps.IsFirstInGroup = true; buttonTool3.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; ribbonGroup1.Tools.AddRange(new ToolBase[] { buttonTool1, buttonTool2, buttonTool3}); ribbonTab1.Groups.AddRange(new[] { ribbonGroup1}); ultraToolbarsManager.Ribbon.NonInheritedRibbonTabs.AddRange(new[] { ribbonTab1}); ultraToolbarsManager.Ribbon.Visible = true; ultraToolbarsManager.ShowFullMenusDelay = 500; appearance1.Image = Resources.folder; buttonTool4.SharedPropsInternal.AppearancesLarge.Appearance = appearance1; appearance2.Image = Resources.folder1; buttonTool4.SharedPropsInternal.AppearancesSmall.Appearance = appearance2; buttonTool4.SharedPropsInternal.Caption = @"Apri"; appearance3.Image = Resources.disk; buttonTool5.SharedPropsInternal.AppearancesLarge.Appearance = appearance3; appearance4.Image = Resources.disk1; buttonTool5.SharedPropsInternal.AppearancesSmall.Appearance = appearance4; buttonTool5.SharedPropsInternal.Caption = @"Salva"; appearance5.Image = Resources.door_out; buttonTool6.SharedPropsInternal.AppearancesLarge.Appearance = appearance5; appearance6.Image = Resources.door_out1; buttonTool6.SharedPropsInternal.AppearancesSmall.Appearance = appearance6; buttonTool6.SharedPropsInternal.Caption = @"Chiudi"; buttonTool8.SharedPropsInternal.Caption = @"Esci"; buttonTool8.SharedPropsInternal.CustomizerCaption = @"Esci"; ultraToolbarsManager.Tools.AddRange(new ToolBase[] { buttonTool4, buttonTool5, buttonTool6, buttonTool8}); ultraToolbarsManager.ToolClick += ultraToolbarsManager_ToolClick; // // _frmMain_Toolbars_Dock_Area_Left // _frmMain_Toolbars_Dock_Area_Left.AccessibleRole = AccessibleRole.Grouping; _frmMain_Toolbars_Dock_Area_Left.BackColor = Color.FromArgb(191, 219, 255); _frmMain_Toolbars_Dock_Area_Left.DockedPosition = DockedPosition.Left; _frmMain_Toolbars_Dock_Area_Left.ForeColor = SystemColors.ControlText; _frmMain_Toolbars_Dock_Area_Left.InitialResizeAreaExtent = 8; _frmMain_Toolbars_Dock_Area_Left.Location = new Point(0, 162); _frmMain_Toolbars_Dock_Area_Left.Name = "_frmMain_Toolbars_Dock_Area_Left"; _frmMain_Toolbars_Dock_Area_Left.Size = new Size(8, 403); _frmMain_Toolbars_Dock_Area_Left.ToolbarsManager = ultraToolbarsManager; // // _frmMain_Toolbars_Dock_Area_Right // _frmMain_Toolbars_Dock_Area_Right.AccessibleRole = AccessibleRole.Grouping; _frmMain_Toolbars_Dock_Area_Right.BackColor = Color.FromArgb(191, 219, 255); _frmMain_Toolbars_Dock_Area_Right.DockedPosition = DockedPosition.Right; _frmMain_Toolbars_Dock_Area_Right.ForeColor = SystemColors.ControlText; _frmMain_Toolbars_Dock_Area_Right.InitialResizeAreaExtent = 8; _frmMain_Toolbars_Dock_Area_Right.Location = new Point(943, 162); _frmMain_Toolbars_Dock_Area_Right.Name = "_frmMain_Toolbars_Dock_Area_Right"; _frmMain_Toolbars_Dock_Area_Right.Size = new Size(8, 403); _frmMain_Toolbars_Dock_Area_Right.ToolbarsManager = ultraToolbarsManager; // // _frmMain_Toolbars_Dock_Area_Top // _frmMain_Toolbars_Dock_Area_Top.AccessibleRole = AccessibleRole.Grouping; _frmMain_Toolbars_Dock_Area_Top.BackColor = Color.FromArgb(191, 219, 255); _frmMain_Toolbars_Dock_Area_Top.DockedPosition = DockedPosition.Top; _frmMain_Toolbars_Dock_Area_Top.ForeColor = SystemColors.ControlText; _frmMain_Toolbars_Dock_Area_Top.Location = new Point(0, 0); _frmMain_Toolbars_Dock_Area_Top.Name = "_frmMain_Toolbars_Dock_Area_Top"; _frmMain_Toolbars_Dock_Area_Top.Size = new Size(951, 162); _frmMain_Toolbars_Dock_Area_Top.ToolbarsManager = ultraToolbarsManager; // // _frmMain_Toolbars_Dock_Area_Bottom // _frmMain_Toolbars_Dock_Area_Bottom.AccessibleRole = AccessibleRole.Grouping; _frmMain_Toolbars_Dock_Area_Bottom.BackColor = Color.FromArgb(191, 219, 255); _frmMain_Toolbars_Dock_Area_Bottom.DockedPosition = DockedPosition.Bottom; _frmMain_Toolbars_Dock_Area_Bottom.ForeColor = SystemColors.ControlText; _frmMain_Toolbars_Dock_Area_Bottom.InitialResizeAreaExtent = 8; _frmMain_Toolbars_Dock_Area_Bottom.Location = new Point(0, 565); _frmMain_Toolbars_Dock_Area_Bottom.Name = "_frmMain_Toolbars_Dock_Area_Bottom"; _frmMain_Toolbars_Dock_Area_Bottom.Size = new Size(951, 8); _frmMain_Toolbars_Dock_Area_Bottom.ToolbarsManager = ultraToolbarsManager; // // openFileDialog // openFileDialog.DefaultExt = "SferaAssembleaOffline"; openFileDialog.Filter = @"Pacchetto assemblea offline (*.SferaAssembleaOffline)|*.SferaAssembleaOffline"; // // frmMain // ClientSize = new Size(951, 573); Controls.Add(_frmMain_Toolbars_Dock_Area_Left); Controls.Add(_frmMain_Toolbars_Dock_Area_Right); Controls.Add(_frmMain_Toolbars_Dock_Area_Bottom); Controls.Add(_frmMain_Toolbars_Dock_Area_Top); Icon = ((Icon)(resources.GetObject("$this.Icon"))); IsMdiContainer = true; Name = "FrmMain"; Text = @"Sfera - Assemblea Offline"; WindowState = FormWindowState.Maximized; MdiChildActivate += frmMain_MdiChildActivate; ((ISupportInitialize)(ultraToolbarsManager)).EndInit(); ResumeLayout(false); }
private void setupServerDatabaseTab() { // Server Tab var btServerProperties = new ButtonTool("btServerProperties"); btServerProperties.SharedProps.Caption = "Server Properties"; btServerProperties.SharedProps.AppearancesSmall.Appearance.Image = 6; var btCreateDatabase = new ButtonTool("btCreateDatabase"); btCreateDatabase.SharedProps.Caption = "Create Database"; btCreateDatabase.SharedProps.AppearancesSmall.Appearance.Image = 17; _view.tbManager.Tools.Add(btCreateDatabase); _view.tbManager.Tools.Add(btServerProperties); var rtServer = new RibbonTab("rtServer", "Server, Database"); var rgServer = new RibbonGroup("rgServer", "Server"); rgServer.Tools.Add(btCreateDatabase); rgServer.Tools.Add(btServerProperties); rtServer.Groups.Add(rgServer); _view.tbManager.Ribbon.Tabs.Add(rtServer); var btDatabaseProperties = new ButtonTool("btDatabaseProperties"); btDatabaseProperties.SharedProps.Caption = "Database Properties"; btDatabaseProperties.SharedProps.AppearancesSmall.Appearance.Image = 17; //var btAnalyzeDatabase = new ButtonTool("btAnalyzeDatabase"); //btAnalyzeDatabase.SharedProps.Caption = "Analyze Database"; //btAnalyzeDatabase.SharedProps.AppearancesSmall.Appearance.Image = 17; var btCreateTable = new ButtonTool("btCreateTable"); btCreateTable.SharedProps.Caption = "Create Table"; btCreateTable.SharedProps.AppearancesSmall.Appearance.Image = 4; var btCreateView = new ButtonTool("btCreateView"); btCreateView.SharedProps.Caption = "Create View"; btCreateView.SharedProps.AppearancesSmall.Appearance.Image = 7; var btCreateProcedure = new ButtonTool("btCreateProcedure"); btCreateProcedure.SharedProps.Caption = "Create Procedure"; // btCreateProcedure.SharedProps.AppearancesSmall.Appearance.Image = 17; var btCreateFunction = new ButtonTool("btCreateFunction"); btCreateFunction.SharedProps.Caption = "Create Function"; // btCreateFunction.SharedProps.AppearancesSmall.Appearance.Image = 17; _view.tbManager.Tools.Add(btDatabaseProperties); _view.tbManager.Tools.Add(btCreateTable); _view.tbManager.Tools.Add(btCreateView); _view.tbManager.Tools.Add(btCreateProcedure); _view.tbManager.Tools.Add(btCreateFunction); // var rtDatabase = new RibbonTab("rtDatabase", "Database"); var rgDatabase = new RibbonGroup("rgDatabase", "Database"); rgDatabase.Tools.Add(btDatabaseProperties); rgDatabase.Tools.Add(btCreateTable); rgDatabase.Tools.Add(btCreateView); rgDatabase.Tools.Add(btCreateProcedure); rgDatabase.Tools.Add(btCreateFunction); rtServer.Groups.Add(rgDatabase); // _view.tbManager.Ribbon.Tabs.Add(rtDatabase); }
protected void SetupRibbon() { ASPxRibbon ribbon = new ASPxRibbon(); RibbonTab tab = new RibbonTab(); RibbonGroup editingGroup = new RibbonGroup(); editingGroup.Name = "Editing"; editingGroup.Text = "Editing"; RibbonButtonItem commitItem = new RibbonButtonItem { Name = "TranslateEmployeeData", Text = "Auto-correct data", Size = RibbonItemSize.Large, ToolTip = HelpText.TranslationDescription }; commitItem.LargeImage.IconID = IconImage.Save_Large; editingGroup.Items.Add(commitItem); RibbonButtonItem dontCommitItem = new RibbonButtonItem { Name = "TranslateEmployeeDataWithoutCommiting", Text = "See what will change", Size = RibbonItemSize.Large, ToolTip = "This will not save any changes to the employees" }; dontCommitItem.LargeImage.IconID = IconImage.Search_Large; editingGroup.Items.Add(dontCommitItem); editingGroup.Items.Add(RibbonButtonItem("Edit", RibbonItemSize.Large, IconImage.Edit_Large)); tab.Groups.Add(editingGroup); ribbon.Tabs.Add(tab); ribbon.ShowTabs = false; ShowRibbon(ribbon); }
private void InitializeComponents() { // Instantiate Controls HelpButton = new RibbonHelpButton(ribbon, (uint)RibbonMarkupCommands.HelpButton); ApplicationMenu = new RibbonApplicationMenu(ribbon, (uint)RibbonMarkupCommands.ApplicationMenu); RecentItems = new RibbonRecentItems(ribbon, (uint)RibbonMarkupCommands.RecentItems); ButtonNew = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ButtonNew); ButtonOpen = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ButtonOpen); ButtonSave = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ButtonSave); SaveAs = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SaveAs); SaveAll = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SaveAll); Export = new RibbonDropDownButton(ribbon, (uint)RibbonMarkupCommands.Export); ExportAsPNG = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExportAsPNG); ExportAsJPG = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExportAsJPG); Close = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Close); ButtonExit = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ButtonExit); TabHome = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabHome); NewNode = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.NewNode); NewChildNode = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewChildNode); NewLongNode = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewLongNode); NewNodeAbove = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewNodeAbove); NewNodeBelow = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewNodeBelow); NewNodeParent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewNodeParent); GrpEdit = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpEdit); EditText = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.EditText); EditLong = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.EditLong); DeleteNode = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.DeleteNode); GrpClipboard = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpClipboard); Paste = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Paste); PasteAsText = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.PasteAsText); PasteAsImage = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.PasteAsImage); Cut = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Cut); Copy = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Copy); FormatPainter = new RibbonToggleButton(ribbon, (uint)RibbonMarkupCommands.FormatPainter); GrpFont = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpFont); RichFont = new RibbonFontControl(ribbon, (uint)RibbonMarkupCommands.RichFont); GrpFormat = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpFormat); BackColor = new RibbonDropDownColorPicker(ribbon, (uint)RibbonMarkupCommands.BackColor); ClearFormatting = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ClearFormatting); GrpIcons = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpIcons); IconsGallery = new RibbonInRibbonGallery(ribbon, (uint)RibbonMarkupCommands.IconsGallery); RemoveLastIcon = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.RemoveLastIcon); RemoveAllIcons = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.RemoveAllIcons); LaunchIconsDialog = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LaunchIconsDialog); TabEdit = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabEdit); GrpSelect = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpSelect); SelectAll = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectAll); SelectSiblings = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectSiblings); SelectAncestors = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectAncestors); SelectChildren = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectChildren); SelectDescendents = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendents); SelectDescendentsUpto1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto1); SelectDescendentsUpto2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto2); SelectDescendentsUpto3 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto3); SelectDescendentsUpto4 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto4); SelectDescendentsUpto5 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto5); ExpandOnSelect = new RibbonCheckBox(ribbon, (uint)RibbonMarkupCommands.ExpandOnSelect); SelectLevel = new RibbonDropDownButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel); SelectLevel1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel1); SelectLevel2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel2); SelectLevel3 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel3); SelectLevel4 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel4); SelectLevel5 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel5); SelectLevelCurrent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevelCurrent); GrpExpand = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpExpand); ExpandAll = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandAll); CollapseAll = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.CollapseAll); ToggleCurrent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ToggleCurrent); ToggleBranch = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ToggleBranch); ExpandMapToCurrentLevel = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToCurrentLevel); ExpandMapToLevel1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel1); ExpandMapToLevel2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel2); ExpandMapToLevel3 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel3); ExpandMapToLevel4 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel4); ExpandMapToLevel5 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel5); GrpNavigate = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNavigate); NavigateToCenter = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NavigateToCenter); NavigateToFirstSibling = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NavigateToFirstSibling); NavigateToLastSibling = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NavigateToLastSibling); GrpMove = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpMove); MoveUp = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveUp); MoveDown = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveDown); GrpSort = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpSort); SortAlphabetic = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortAlphabetic); SortDueDate = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortDueDate); SortNodeCount = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortNodeCount); SortCreateDate = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortCreateDate); SortModifiedDate = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortModifiedDate); SortOrder = new RibbonToggleButton(ribbon, (uint)RibbonMarkupCommands.SortOrder); GrpUndo = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpUndo); Undo = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Undo); Redo = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Redo); TabInsert = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabInsert); GrpHyperlink = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpHyperlink); Hyperlink = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Hyperlink); HyperlinkFile = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.HyperlinkFile); HyperlinkFolder = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.HyperlinkFolder); RemoveHyperlink = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.RemoveHyperlink); GrpNote = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNote); InsertNote = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertNote); GrpImage = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpImage); InsertImage = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertImage); GrpTask = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpTask); AddTask = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTask); AddTaskToday = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskToday); AddTaskTomorrow = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskTomorrow); AddTaskNextWeek = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskNextWeek); AddTaskNextMonth = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskNextMonth); AddTaskNextQuarter = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskNextQuarter); CompleteTask = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.CompleteTask); RemoveTask = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.RemoveTask); TabFormat = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabFormat); GrpNodeFormat = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNodeFormat); NodeShape = new RibbonDropDownGallery(ribbon, (uint)RibbonMarkupCommands.NodeShape); ClearShapeFormat = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ClearShapeFormat); LineColor = new RibbonDropDownColorPicker(ribbon, (uint)RibbonMarkupCommands.LineColor); LinePattern = new RibbonDropDownButton(ribbon, (uint)RibbonMarkupCommands.LinePattern); LinePatternSolid = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LinePatternSolid); LinePatternDashed = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LinePatternDashed); LinePatternDotted = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LinePatternDotted); LinePatternMixed = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LinePatternMixed); LineThickness = new RibbonDropDownButton(ribbon, (uint)RibbonMarkupCommands.LineThickness); LineThickness1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LineThickness1); LineThickness2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LineThickness2); LineThickness4 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LineThickness4); GrpNodeStyle = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNodeStyle); NodeStyleGallery = new RibbonInRibbonGallery(ribbon, (uint)RibbonMarkupCommands.NodeStyleGallery); CreateNodeStyle = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.CreateNodeStyle); GrpClearFormat = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpClearFormat); TabView = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabView); GrpViewTask = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpViewTask); ViewCalendar = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ViewCalendar); ViewTaskList = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ViewTaskList); GrpViewNote = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpViewNote); ViewNote = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ViewNote); TabImage = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabImage); RemoveImage = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.RemoveImage); GrpImageSize = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpImageSize); IncreaseImageSize = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.IncreaseImageSize); DecreaseImageSize = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.DecreaseImageSize); GrpImageAlign = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpImageAlign); ImageAlignStart = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ImageAlignStart); ImageAlignCenter = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ImageAlignCenter); ImageAlignEnd = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ImageAlignEnd); GrpImagePosition = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpImagePosition); ImagePosAbove = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ImagePosAbove); ImagePosBefore = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ImagePosBefore); ImagePosBelow = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ImagePosBelow); ImagePosAfter = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ImagePosAfter); TabGroupNote = new RibbonTabGroup(ribbon, (uint)RibbonMarkupCommands.TabGroupNote); TabNoteEditor = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabNoteEditor); GrpNoteFont = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteFont); GrpNoteClearFormat = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteClearFormat); GrpParagraph = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpParagraph); Bullets = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Bullets); Numbers = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Numbers); Outdent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Outdent); Indent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Indent); AlignLeft = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AlignLeft); AlignCenter = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AlignCenter); AlignRight = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AlignRight); Justify = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Justify); GrpNoteStyles = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteStyles); NoteHeading1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteHeading1); NoteHeading2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteHeading2); NoteHeading3 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteHeading3); NoteNormal = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteNormal); GrpNoteTable = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteTable); NoteInsertTable = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteInsertTable); GrpNoteInsertImage = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteInsertImage); NoteInsertImage = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteInsertImage); GrpNoteEditHtml = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteEditHtml); NoteEditHtml = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteEditHtml); TabGroupNoteTable = new RibbonTabGroup(ribbon, (uint)RibbonMarkupCommands.TabGroupNoteTable); TabNoteTableLayout = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabNoteTableLayout); GrpCustomizeTable = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpCustomizeTable); ModifyTableProperties = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ModifyTableProperties); GrpTableDelete = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpTableDelete); DeleteRow = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.DeleteRow); DeleteColumn = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.DeleteColumn); DeleteTable = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.DeleteTable); GrpTableInsert = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpTableInsert); InsertRowAbove = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertRowAbove); InsertRowBelow = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertRowBelow); InsertColumnLeft = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertColumnLeft); InsertColumnRight = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertColumnRight); GrpTableMove = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpTableMove); MoveRowUp = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveRowUp); MoveRowDown = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveRowDown); MoveColumnLeft = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveColumnLeft); MoveColumnRight = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveColumnRight); }
protected void SetupRibbon() { ASPxRibbon ribbon = new ASPxRibbon(); RibbonTab tab = new RibbonTab(); RibbonGroup editingGroup = new RibbonGroup(); editingGroup.Name = "Editing"; editingGroup.Text = "Editing"; if (importTask.Oid == Guid.Empty) { editingGroup.Items.Add(RibbonButtonItem("Save", "Start campaign", RibbonItemSize.Large, IconImage.Save_Large)); } else { editingGroup.Items.Add(RibbonButtonItem("Save", "Save and restart campaign", RibbonItemSize.Large, IconImage.Restart_Large, null, "This will require emails to be re-sent")); } if (importTask.Oid != Guid.Empty) { if (importTask.ImportTaskConfiguration != null) { RibbonButtonItem configureItem = new RibbonButtonItem { Name = "Overview", Text = "Overview", Size = RibbonItemSize.Large, NavigateUrl = UrlManager.PhonebooksImportTaskOverviewWithOid(importTask.Oid) }; configureItem.LargeImage.IconID = IconImage.Search_Large; editingGroup.Items.Add(configureItem); } } if (importTask.Oid != Guid.Empty) { editingGroup.Items.Add(RibbonButtonItem("Cancel", "Stop campaign", RibbonItemSize.Large, IconImage.Delete_Large)); } tab.Groups.Add(editingGroup); ribbon.Tabs.Add(tab); ribbon.ShowTabs = false; ShowRibbon(ribbon); }
private int setupExternalTools(RibbonGroup rgMicrosoft, string toolsPath, string toolsPathVs) { if (!string.IsNullOrEmpty(toolsPath)) { var fiProfiler = new FileInfo(toolsPath + @"\" + "profiler.exe"); if (fiProfiler.Exists) { var btProfiler10 = new ButtonTool("btProfiler10"); btProfiler10.SharedProps.Caption = "Profiler"; btProfiler10.Tag = fiProfiler.FullName; btProfiler10.ToolClick += RibbonEventHandlers.btExternalTool_ToolClick; _view.tbManager.Tools.Add(btProfiler10); int pos = rgMicrosoft.Tools.Add(btProfiler10); rgMicrosoft.Tools[pos].Tag = btProfiler10.Tag; } var fiPs = new FileInfo(toolsPath + @"\" + "sqlps.exe"); if (fiPs.Exists) { var btSqlPs10 = new ButtonTool("btSqlPs10"); btSqlPs10.SharedProps.Caption = "SQL PowerShell"; btSqlPs10.Tag = fiPs.FullName; btSqlPs10.ToolClick += RibbonEventHandlers.btExternalTool_ToolClick; _view.tbManager.Tools.Add(btSqlPs10); int pos = rgMicrosoft.Tools.Add(btSqlPs10); rgMicrosoft.Tools[pos].Tag = btSqlPs10.Tag; } } if (!string.IsNullOrEmpty(toolsPathVs)) { var fiCopyDb = new FileInfo(toolsPathVs + @"\" + "CopyDatabaseWizard.exe"); if (fiCopyDb.Exists) { var btCopyDatabaseWizard10 = new ButtonTool("btCopyDatabaseWizard10"); btCopyDatabaseWizard10.SharedProps.Caption = "Copy Database Wizard"; btCopyDatabaseWizard10.Tag = fiCopyDb.FullName; btCopyDatabaseWizard10.ToolClick += RibbonEventHandlers.btExternalTool_ToolClick; _view.tbManager.Tools.Add(btCopyDatabaseWizard10); int pos = rgMicrosoft.Tools.Add(btCopyDatabaseWizard10); rgMicrosoft.Tools[pos].Tag = btCopyDatabaseWizard10.Tag; } var fiSsms = new FileInfo(toolsPathVs + @"\" + "ssms.exe"); if (fiSsms.Exists) { var btSsms10 = new ButtonTool("btSsms10"); btSsms10.SharedProps.Caption = "Management Studio"; btSsms10.Tag = fiSsms.FullName; btSsms10.ToolClick += RibbonEventHandlers.btExternalTool_ToolClick; _view.tbManager.Tools.Add(btSsms10); int pos = rgMicrosoft.Tools.Add(btSsms10); rgMicrosoft.Tools[pos].Tag = btSsms10.Tag; } } return(rgMicrosoft.Tools.Count); }
private ToolBase addPluginTool(RibbonGroup group, string key, GruppiMenuVoceDTO voce, Bitmap imageLarge, Bitmap imageSmall) { ToolBase tool; if (voce == null || string.IsNullOrEmpty(voce.NomeGruppoPopup)) tool = group.Tools.AddTool(key); else { group.Settings.CanCollapse = DefaultableBoolean.False; PopupMenuTool popupMenuTool; // Creo e aggiungo il menu tool se non esiste ancora var menuKey = group.Key + "_" + voce.NomeGruppoPopup + "_Gruppo"; if (!group.Tools.Exists(menuKey)) { popupMenuTool = new PopupMenuTool(menuKey) {AllowTearaway = true}; // Set some properties on the Popup menu popupMenuTool.InstanceProps.MinimumSizeOnRibbon = RibbonToolSize.Large; popupMenuTool.SharedProps.Caption = voce.NomeGruppoPopup; popupMenuTool.SharedProps.AppearancesLarge.Appearance.Image = imageLarge; popupMenuTool.SharedProps.AppearancesSmall.Appearance.Image = imageSmall; group.Tab.Ribbon.ToolbarsManager.Tools.Add(popupMenuTool); group.Tools.AddTool(menuKey); } else popupMenuTool = (PopupMenuTool)group.Tools[menuKey]; tool = popupMenuTool.Tools.AddTool(key); } return tool; }
/// <summary> /// Dựng menu ribbon của hệ thống theo user đăng nhập /// </summary> /// <param name="rbMenu">Control Menu ribbon được tham chiếu, xử lý rồi trả về</param> public void KhoiTaoMenu(ref Ribbon rbMenu) { try { string toolTip; ChucNangDto[] ChucNanglst = ClientInformation.ListChucNang.Select(e => e).ToArray(); IQueryable <ChucNangDto> sItem; string pathFolderImages = ApplicationConstant.defaultImageSource; // Lấy danh sách menu theo tên đăng nhập và mã đơn vị var sTab = ChucNanglst.Where(e => e.IDChucNangCha == 0).OrderBy(e => e.STT).ToList(); foreach (var Tab in sTab) { if (Tab.ThuocTinh.SplitByDelimiter("#")[2] == "RibbonApplicationMenu") { // Application menu RibbonApplicationMenu ram = new RibbonApplicationMenu(); ram.Label = Utilities.Common.LLanguage.SearchResourceByKey(Tab.TieuDe); if (!Tab.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Tab.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Tab.TieuDe; } ram.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); ram.KeyTip = Tab.ThuocTinh.SplitByDelimiter("#")[3]; ram.Uid = Tab.IDChucNang.ToString(); if (!Tab.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Tab.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Tab.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); // RibbonMenuItem icon always small ram.SmallImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Tab.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); ram.SmallImageSource = bmp; } } catch { } } var sMenu = ChucNanglst.Where(e => e.IDChucNangCha == Tab.IDChucNang).OrderBy(e => e.STT).AsQueryable(); foreach (var Menu in sMenu) { switch (Menu.ThuocTinh.SplitByDelimiter("#")[2]) { case "RibbonApplicationSplitMenuItem": if (Menu.Quyen == 0) { goto case "RibbonApplicationMenuItem"; } var rasmi = new RibbonApplicationSplitMenuItem(); rasmi.Name = "ID" + Menu.IDChucNang.ToString(); rasmi.Header = Utilities.Common.LLanguage.SearchResourceByKey(Menu.TieuDe); if (!Menu.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Menu.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Menu.TieuDe; } rasmi.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); rasmi.KeyTip = Menu.ThuocTinh.SplitByDelimiter("#")[3]; rasmi.Uid = Menu.IDChucNang.ToString(); if (!Menu.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[0], UriKind.RelativeOrAbsolute); bmp.EndInit(); // RibbonApplicationSplitMenuItem icon always large rasmi.ImageSource = bmp; bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); // QuickAccessToolBar icon always small rasmi.QuickAccessToolBarImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); rasmi.ImageSource = bmp; rasmi.QuickAccessToolBarImageSource = bmp; } } catch { } } rasmi.Tag = Menu; //rasmi.IsEnabled = Menu.Quyen > 0; // Items sItem = ChucNanglst.Where(e => e.IDChucNangCha == Menu.IDChucNang).OrderBy(e => e.STT).AsQueryable(); foreach (var Item in sItem) { var item = new RibbonApplicationMenuItem(); item.Name = "ID" + Item.IDChucNang.ToString(); item.Header = Utilities.Common.LLanguage.SearchResourceByKey(Item.TieuDe); if (!Item.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Item.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Item.TieuDe; } item.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); item.KeyTip = Item.ThuocTinh.SplitByDelimiter("#")[3]; item.Uid = Item.IDChucNang.ToString(); if (!Item.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Item.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong.SplitByDelimiter("#")[0], UriKind.RelativeOrAbsolute); bmp.EndInit(); // RibbonApplicationMenuItem icon always large item.ImageSource = bmp; bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); // QuickAccessToolBar icon always small item.QuickAccessToolBarImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); item.ImageSource = bmp; item.QuickAccessToolBarImageSource = bmp; } } catch { } } item.Tag = Item; item.IsEnabled = Item.Quyen > 0; rasmi.Items.Add(item); } ram.Items.Add(rasmi); break; case "RibbonApplicationMenuItem": var rami = new RibbonApplicationMenuItem(); rami.Name = "ID" + Menu.IDChucNang.ToString(); rami.Header = Utilities.Common.LLanguage.SearchResourceByKey(Menu.TieuDe); if (!Menu.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Menu.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Menu.TieuDe; } rami.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); rami.KeyTip = Menu.ThuocTinh.SplitByDelimiter("#")[3]; rami.Uid = Menu.IDChucNang.ToString(); if (!Menu.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[0], UriKind.RelativeOrAbsolute); bmp.EndInit(); // RibbonApplicationMenuItem icon always large rami.ImageSource = bmp; bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); // QuickAccessToolBar icon always small rami.QuickAccessToolBarImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); rami.ImageSource = bmp; rami.QuickAccessToolBarImageSource = bmp; } } catch { } } if (!Menu.ChucNang.IsNullOrEmptyOrSpace()) { rami.Tag = Menu; } //rami.IsEnabled = Menu.Quyen > 0; // Items sItem = ChucNanglst.Where(e => e.IDChucNangCha == Menu.IDChucNang).OrderBy(e => e.STT).AsQueryable(); foreach (var Item in sItem) { var item = new RibbonApplicationMenuItem(); item.Name = "ID" + Item.IDChucNang.ToString(); item.Header = Utilities.Common.LLanguage.SearchResourceByKey(Item.TieuDe); if (!Item.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Item.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Item.TieuDe; } item.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); item.KeyTip = Item.ThuocTinh.SplitByDelimiter("#")[3]; item.Uid = Item.IDChucNang.ToString(); if (!Item.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Item.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong.SplitByDelimiter("#")[0], UriKind.RelativeOrAbsolute); bmp.EndInit(); // RibbonApplicationMenuItem icon always large item.ImageSource = bmp; bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); // QuickAccessToolBar icon always small item.QuickAccessToolBarImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); item.ImageSource = bmp; item.QuickAccessToolBarImageSource = bmp; } } catch { } } item.Tag = Item; item.IsEnabled = Item.Quyen > 0; rami.Items.Add(item); } ram.Items.Add(rami); break; default: Grid grid; if (ram.FooterPaneContent.IsNullOrEmpty()) { grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition()); ColumnDefinition cd = new ColumnDefinition(); cd.Width = GridLength.Auto; grid.ColumnDefinitions.Add(cd); ram.FooterPaneContent = grid; } else { grid = (Grid)(ram.FooterPaneContent); } var rb = new RibbonButton(); rb.Name = "ID" + Menu.IDChucNang.ToString(); rb.Label = Utilities.Common.LLanguage.SearchResourceByKey(Menu.TieuDe); if (!Menu.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Menu.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Menu.TieuDe; } rb.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); rb.KeyTip = Menu.ThuocTinh.SplitByDelimiter("#")[3]; rb.Uid = Menu.IDChucNang.ToString(); if (!Menu.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[0], UriKind.RelativeOrAbsolute); bmp.EndInit(); rb.LargeImageSource = bmp; bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); rb.SmallImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Large") { rb.LargeImageSource = bmp; } else { rb.SmallImageSource = bmp; } } } catch { } } rb.Tag = Menu; rb.IsEnabled = Menu.Quyen > 0; grid.Children.Add(rb); Grid.SetColumn(rb, 1); break; } } rbMenu.ApplicationMenu = ram; } else { // Tabs RibbonTab tab = new RibbonTab(); Type rthType = new RibbonTabHeader().GetType(); tab.Header = Utilities.Common.LLanguage.SearchResourceByKey(Tab.TieuDe); if (!Tab.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Tab.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Tab.TieuDe; } tab.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); tab.HeaderStyle = new Style(rthType); tab.HeaderStyle.Setters.Add(new Setter(RibbonWindow.ToolTipProperty, tab.ToolTip)); tab.IsEnabled = Tab.Quyen > 0; tab.Uid = Tab.IDChucNang.ToString(); // Groups var sGroup = ChucNanglst.Where(e => e.IDChucNangCha == Tab.IDChucNang).OrderBy(e => e.STT).AsQueryable(); foreach (var Group in sGroup) { RibbonGroup group = new RibbonGroup(); group.Header = Utilities.Common.LLanguage.SearchResourceByKey(Group.TieuDe); group.IsEnabled = Group.Quyen > 0; // Buttons var sMenu = ChucNanglst.Where(e => e.IDChucNangCha == Group.IDChucNang).OrderBy(e => e.STT).AsQueryable(); foreach (var Menu in sMenu) { switch (Menu.ThuocTinh.SplitByDelimiter("#")[2]) { case "RibbonSplitButton": if (Menu.Quyen == 0) { goto case "RibbonMenuButton"; } var rsb = new RibbonSplitButton(); rsb.Name = "ID" + Menu.IDChucNang.ToString(); rsb.Label = Utilities.Common.LLanguage.SearchResourceByKey(Menu.TieuDe); if (!Menu.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Menu.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Menu.TieuDe; } rsb.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); rsb.KeyTip = Menu.ThuocTinh.SplitByDelimiter("#")[3]; rsb.Uid = Menu.IDChucNang.ToString(); if (!Menu.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[0], UriKind.RelativeOrAbsolute); bmp.EndInit(); rsb.LargeImageSource = bmp; bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); rsb.SmallImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Large") { rsb.LargeImageSource = bmp; } else { rsb.SmallImageSource = bmp; } } } catch { } } rsb.Tag = Menu; //rsb.IsEnabled = Menu.Quyen > 0; // Items sItem = ChucNanglst.Where(e => e.IDChucNangCha == Menu.IDChucNang).OrderBy(e => e.STT).AsQueryable(); foreach (var Item in sItem) { var item = new RibbonMenuItem(); item.Name = "ID" + Item.IDChucNang.ToString(); item.Header = Utilities.Common.LLanguage.SearchResourceByKey(Item.TieuDe); if (!Item.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Item.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Item.TieuDe; } item.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); item.KeyTip = Item.ThuocTinh.SplitByDelimiter("#")[3]; item.Uid = Item.IDChucNang.ToString(); if (!Item.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Item.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); // RibbonMenuItem icon always small item.ImageSource = bmp; // QuickAccessToolBar icon always small item.QuickAccessToolBarImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); item.ImageSource = bmp; item.QuickAccessToolBarImageSource = bmp; } } catch { } } item.Tag = Item; item.IsEnabled = Item.Quyen > 0; rsb.Items.Add(item); } group.Items.Add(rsb); break; case "RibbonMenuButton": var rmb = new RibbonMenuButton(); rmb.Name = "ID" + Menu.IDChucNang.ToString(); rmb.Label = Utilities.Common.LLanguage.SearchResourceByKey(Menu.TieuDe); if (!Menu.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Menu.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Menu.TieuDe; } rmb.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); rmb.KeyTip = Menu.ThuocTinh.SplitByDelimiter("#")[3]; rmb.Uid = Menu.IDChucNang.ToString(); if (!Menu.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[0], UriKind.RelativeOrAbsolute); bmp.EndInit(); rmb.LargeImageSource = bmp; bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); rmb.SmallImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Large") { rmb.LargeImageSource = bmp; } else { rmb.SmallImageSource = bmp; } } } catch { } } //rmb.IsEnabled = Menu.Quyen > 0; // Items sItem = ChucNanglst.Where(e => e.IDChucNangCha == Menu.IDChucNang).OrderBy(e => e.STT).AsQueryable(); foreach (var Item in sItem) { var item = new RibbonMenuItem(); item.Name = "ID" + Item.IDChucNang.ToString(); item.Header = Utilities.Common.LLanguage.SearchResourceByKey(Item.TieuDe); if (!Item.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Item.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Item.TieuDe; } item.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); item.KeyTip = Item.ThuocTinh.SplitByDelimiter("#")[3]; item.Uid = Item.IDChucNang.ToString(); if (!Item.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Item.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); // RibbonMenuItem icon always small item.ImageSource = bmp; // QuickAccessToolBar icon always small item.QuickAccessToolBarImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Item.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); item.ImageSource = bmp; item.QuickAccessToolBarImageSource = bmp; } } catch { } } item.Tag = Item; item.IsEnabled = Item.Quyen > 0; rmb.Items.Add(item); } group.Items.Add(rmb); break; default: var rb = new RibbonButton(); rb.Name = "ID" + Menu.IDChucNang.ToString(); rb.Label = Utilities.Common.LLanguage.SearchResourceByKey(Menu.TieuDe); if (!Menu.ThuocTinh.SplitByDelimiter("#")[0].IsNullOrEmptyOrSpace()) { toolTip = Menu.ThuocTinh.SplitByDelimiter("#")[0]; } else { toolTip = Menu.TieuDe; } rb.ToolTip = Utilities.Common.LLanguage.SearchResourceByKey(toolTip); rb.KeyTip = Menu.ThuocTinh.SplitByDelimiter("#")[3]; rb.Uid = Menu.IDChucNang.ToString(); if (!Menu.BieuTuong.IsNullOrEmptyOrSpace()) { try { BitmapImage bmp = new BitmapImage(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Both") { bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[0], UriKind.RelativeOrAbsolute); bmp.EndInit(); rb.LargeImageSource = bmp; bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong.SplitByDelimiter("#")[1], UriKind.RelativeOrAbsolute); bmp.EndInit(); rb.SmallImageSource = bmp; } else { // Lagre or Small bmp.BeginInit(); bmp.UriSource = new Uri(pathFolderImages + Menu.BieuTuong, UriKind.RelativeOrAbsolute); bmp.EndInit(); if (Menu.ThuocTinh.SplitByDelimiter("#")[1] == "Large") { rb.LargeImageSource = bmp; } else { rb.SmallImageSource = bmp; } } } catch (Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } } rb.Tag = Menu; rb.IsEnabled = Menu.Quyen > 0; group.Items.Add(rb); break; } } tab.Items.Add(group); } rbMenu.Items.Add(tab); } } } catch (Exception ex) { // Ghi log Exception LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.ERR, ex); } }
private void inizializza() { if (!DesignMode) { _dettaglioPraticaUC1 = _pratica != null ? new DettaglioPraticaUC(_pratica, _richiedenti) : new DettaglioPraticaUC(true); MainStandardForm_Fill_Panel.Controls.Add(_dettaglioPraticaUC1); _dettaglioPraticaUC1.Dock = DockStyle.Fill; var attivita = new RibbonGroup("attivita") { Caption = "Attività", LayoutDirection = RibbonGroupToolLayoutDirection.Vertical, PreferredToolSize = RibbonToolSize.Large }; ultraToolbarsManagerStandard.Ribbon.Tabs["home"].Groups.Add(attivita); attivita.Tools.AddTool("nuovaAttivita"); attivita.Tools.AddTool("chiusura"); } }
private void CreateRibbonBar() { RibbonBar ribbonBar = axCommandBars.AddRibbonBar("DemoSoft Team Ribbon"); ribbonBar.EnableDocking(XTPToolBarFlags.xtpFlagStretched); // 系统菜单 CommandBarPopup popupSystem = ribbonBar.AddSystemButton(); popupSystem.IconId = ResourceId.ID_SYSTEM_ICON; popupSystem.CommandBar.Controls.Add(XTPControlType.xtpControlButton, ResourceId.ID_FILE_CONFIG_POLICY, "配置策略(&P)", false, false); popupSystem.CommandBar.Controls.Add(XTPControlType.xtpControlButton, ResourceId.ID_FILE_CONFIG_TASK, "配置任务(&T)", false, false); CommandBarControl controlSystem = popupSystem.CommandBar.Controls.Add(XTPControlType.xtpControlButton, ResourceId.ID_APP_HIDE, "退出(&E)", false, false); controlSystem.BeginGroup = true; popupSystem.CommandBar.SetIconSize(32, 32); // 关于菜单 CommandBarControl controlAbout = ribbonBar.Controls.Add(XTPControlType.xtpControlButton, ResourceId.ID_APP_ABOUT, "关于(&A)", false, false); controlAbout.Flags = XTPControlFlags.xtpFlagRightAlign; // 开始 RibbonTab tabHome = ribbonBar.InsertTab(0, "开始(&H)"); tabHome.Id = ResourceId.ID_TAB_HOME; // 开始 -> 文件 RibbonGroup groupFile = tabHome.Groups.AddGroup("文件(&F)", ResourceId.ID_GROUP_FILE); CommandBarPopup controlConfig = (CommandBarPopup)groupFile.Add(XTPControlType.xtpControlSplitButtonPopup, ResourceId.ID_FILE_CONFIG_POLICY, "配置策略(&P)", false, false); controlConfig.CommandBar.Controls.Add(XtremeCommandBars.XTPControlType.xtpControlButton, ResourceId.ID_FILE_CONFIG_NEW_POLICY, "新建策略(&N)", false, false); CommandBarPopup controlConfig1 = (CommandBarPopup)groupFile.Add(XTPControlType.xtpControlSplitButtonPopup, ResourceId.ID_FILE_CONFIG_TASK, "配置任务(&T)", false, false); controlConfig1.CommandBar.Controls.Add(XtremeCommandBars.XTPControlType.xtpControlButton, ResourceId.ID_FILE_CONFIG_NEW_TASK, "新建任务(&N)", false, false); //CommandBarPopup controlConfig2 = (CommandBarPopup)groupFile.Add( XTPControlType.xtpControlButtonPopup, ResourceId.ID_FILE_SCAN_TASK, "扫描任务(&T)", false, false ); //controlConfig2.CommandBar.Controls.Add( XtremeCommandBars.XTPControlType.xtpControlButton, ResourceId.ID_FILE_SCAN_ALL_TASK, "扫描全部(&N)", false, false ); // 开始 -> 报表 RibbonGroup groupReport = tabHome.Groups.AddGroup("报表(&R)", ResourceId.ID_GROUP_FILE); m_ControlOpen = (CommandBarPopup)groupReport.Add(XTPControlType.xtpControlButtonPopup, ResourceId.ID_FILE_OPEN, "打开报表(&O)", false, false); m_ControlClose = (CommandBarPopup)groupReport.Add(XTPControlType.xtpControlButtonPopup, ResourceId.ID_FILE_CLOSE, "关闭报表(&C)", false, false); U50GlobalSetting.LoadingTaskSetting += new EventHandler(U50GlobalSetting_LoadingTaskSetting); U50GlobalSetting.LoadedTaskSetting += new EventHandler(U50GlobalSetting_LoadedTaskSetting); TaskManager.Instance.AddedTaskInfo += new EventHandler(U50GlobalSetting_LoadedTaskSetting); TaskManager.Instance.RemoveTaskInfo += new EventHandler(U50GlobalSetting_LoadedTaskSetting); TaskManager.Instance.RefreshTaskInfo += new EventHandler(U50GlobalSetting_LoadedTaskSetting); U50GlobalSetting_LoadedTaskSetting(this, EventArgs.Empty); // 视图 RibbonTab tabView = ribbonBar.InsertTab(2, "视图(&V)"); tabView.Id = ResourceId.ID_TAB_VIEW; // 视图 -> 显示 RibbonGroup groupShow = tabView.Groups.AddGroup("显示(&D)", ResourceId.ID_GROUP_SHOW); CommandBarControl controlWorkspace = groupShow.Add(XTPControlType.xtpControlCheckBox, ResourceId.ID_SHOW_WORKSPACE, "工作区(&W)", false, false); controlWorkspace.Checked = true; groupShow.Add(XTPControlType.xtpControlCheckBox, ResourceId.ID_SHOW_STATUS, "状态栏(&S)", false, false); // 视图 -> 图表 RibbonGroup groupGraph = tabView.Groups.AddGroup("图表(&D)", ResourceId.ID_GROUP_GRAPH); groupGraph.Add(XTPControlType.xtpControlCheckBox, ResourceId.ID_GRAPH_WORKSPACE, "主升浪幅度线(&W)", false, false); groupGraph.Add(XTPControlType.xtpControlCheckBox, ResourceId.ID_GRAPH_STATUS, "下跌浪幅度线(&S)", false, false); groupGraph.Add(XTPControlType.xtpControlCheckBox, ResourceId.ID_GRAPH_STATUS, "盘整浪幅度线(&S)", false, false); groupGraph.Add(XTPControlType.xtpControlCheckBox, ResourceId.ID_GRAPH_STATUS, "整理区幅度线(&S)", false, false); // 工具 RibbonTab tabTools = ribbonBar.InsertTab(3, "工具(&T)"); tabTools.Id = ResourceId.ID_TAB_TOOLS; // 工具 -> 内部工具 RibbonGroup groupTools = tabTools.Groups.AddGroup("内部工具(&I)", ResourceId.ID_GROUP_TOOLS); // Welcome To DemoSoft Team ribbonBar.QuickAccessControls.Add(XTPControlType.xtpControlButton, ResourceId.ID_WELCOME, "Welcome", false, false); ribbonBar.QuickAccessControls.Add(XTPControlType.xtpControlButton, ResourceId.ID_TO, "To", false, false); ribbonBar.QuickAccessControls.Add(XTPControlType.xtpControlButton, ResourceId.ID_DEMO_SOFT, "DemoSoft", false, false); ribbonBar.QuickAccessControls.Add(XTPControlType.xtpControlButton, ResourceId.ID_TEAM, "Team", false, false); }
private static Control MapQatDataToControl(VM.QatItem qatItem) { string typeName = qatItem.Instance.GetType().Name; Control control = null; switch (typeName) { case "ButtonData": { control = new RibbonButton(); control.DataContext = qatItem.Instance; break; } case "ToggleButtonData": { control = new RibbonToggleButton(); control.DataContext = qatItem.Instance; break; } case "RadioButtonData": { control = new RibbonRadioButton(); control.DataContext = qatItem.Instance; break; } case "CheckBoxData": { control = new RibbonCheckBox(); control.DataContext = qatItem.Instance; break; } case "TextBoxData": { control = new RibbonTextBox(); control.DataContext = qatItem.Instance; break; } case "MenuButtonData": { control = new RibbonMenuButton(); control.DataContext = qatItem.Instance; break; } case "SplitButtonData": { if (!qatItem.IsSplitHeader) { control = new RibbonSplitButton(); } else { VM.SplitButtonData splitButtonData = (VM.SplitButtonData)qatItem.Instance; if (splitButtonData.IsCheckable) { control = new RibbonToggleButton(); } else { control = new RibbonButton(); } } control.DataContext = qatItem.Instance; break; } case "ComboBoxData": { control = new RibbonComboBox(); control.DataContext = qatItem.Instance; break; } case "MenuItemData": { VM.MenuItemData menuItemData = (VM.MenuItemData)qatItem.Instance; if (menuItemData.ControlDataCollection.Count > 0) { control = new RibbonMenuButton(); } else { control = new RibbonButton(); } control.DataContext = qatItem.Instance; break; } case "SplitMenuItemData": { VM.SplitMenuItemData splitMenuItemData = (VM.SplitMenuItemData)qatItem.Instance; if (!qatItem.IsSplitHeader) { if (splitMenuItemData.ControlDataCollection.Count > 0) { control = new RibbonSplitButton(); } else if (splitMenuItemData.IsCheckable) { control = new RibbonToggleButton(); } else { control = new RibbonButton(); } } else { control = new RibbonToggleButton(); } control.DataContext = qatItem.Instance; break; } case "GalleryData": { RibbonGallery gallery = new RibbonGallery(); RibbonMenuButton menuButton = new RibbonMenuButton(); menuButton.ItemsSource = new object[] { gallery }; control = menuButton; control.DataContext = qatItem.Instance; break; } case "GroupData": { control = new RibbonGroup(); control.DataContext = qatItem.Instance; break; } } return control; }
/******************* ToolBar 工具列事件 ***********************/ #region WfIniToolBarUI 初始化表單工具列--設定圖案及熱鍵 protected virtual void WfIniToolBarUI() { ImageList ilLarge = new ImageList(); string buttonKey; try { UtbmMain.Style = GetStyleLibrary.UltraWinToolBarDiplayStyle; UtbmMain.UseAppStyling = false; UtbmMain.Office2007UICompatibility = false; UtbmMain.UseOsThemes = DefaultableBoolean.True; UtbmMain.Style = ToolbarStyle.Office2013; UtbmMain.Ribbon.QuickAccessToolbar.Visible = false; UtbmMain.Ribbon.FileMenuStyle = FileMenuStyle.None; UtbmMain.Ribbon.CaptionAreaAppearance.BackColor = Color.FromArgb(210, 210, 210); UtbmMain.Ribbon.FileMenuButtonAppearance.BackColor = Color.FromArgb(67, 168, 152); UtbmMain.Ribbon.FileMenuButtonAppearance.BackGradientStyle = GradientStyle.None; UtbmMain.Ribbon.GroupSettings.CaptionAppearance.FontData.SizeInPoints = 8.5f; UtbmMain.Ribbon.GroupSettings.CaptionAppearance.ForeColor = Color.White; UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.BackColor = Color.FromArgb(66, 126, 123); UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.BackGradientStyle = GradientStyle.None; UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.BorderAlpha = Alpha.Opaque; UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.BorderColor = Color.FromArgb(67, 168, 152); UtbmMain.Ribbon.GroupSettings.HotTrackAppearance.ForeColor = Color.White; //UtbmMain.Ribbon.GroupSettings.ToolAppearance.ImageAlpha = Alpha.UseAlphaLevel; //UtbmMain.Ribbon.GroupSettings.ToolAppearance.AlphaLevel = 100; UtbmMain.Ribbon.GroupSettings.ToolAppearance.ForeColor = Color.FromArgb(179, 187, 191); UtbmMain.Ribbon.TabAreaAppearance.BackColor = Color.FromArgb(67, 168, 152); UtbmMain.Ribbon.TabSettings.Appearance.BackColor = Color.FromArgb(66, 84, 94); UtbmMain.Ribbon.TabSettings.Appearance.BackGradientStyle = GradientStyle.None; UtbmMain.Ribbon.TabSettings.Appearance.BorderAlpha = Alpha.Transparent; UtbmMain.Ribbon.TabSettings.Appearance.ForeColor = Color.White; UtbmMain.Ribbon.TabSettings.SelectedAppearance.BackColor = Color.FromArgb(66, 84, 94); UtbmMain.Ribbon.TabSettings.SelectedAppearance.BorderAlpha = Alpha.Transparent; UtbmMain.Ribbon.TabSettings.TabItemAppearance.BackColor = Color.FromArgb(67, 168, 152); UtbmMain.MdiMergeable = false; //UtbmMain.Style = GetStyleLibrary.UltraWinToolBarDiplayStyle; //UtbmMain.UseAppStyling = false; //if (this.IsMdiChild) //{ // UtbmMain.Office2007UICompatibility = false; // UtbmMain.MdiMergeable = false; // UtbmMain.Ribbon.QuickAccessToolbar.Visible = false; //} //else //{ // UtbmMain.Office2007UICompatibility = false; // UtbmMain.MdiMergeable = false; // UtbmMain.Ribbon.QuickAccessToolbar.Visible = false; //} ilLarge = GlobalPictuer.LoadToolBarImage(); if (ilLarge == null) { return; } UtbmMain.ImageListLarge = ilLarge; #region 產生RibbonTab/及Group RibbonTab RtData = new RibbonTab("RtData", "資料"); //RibbonTab RtReport = new RibbonTab("RtReport", "報表"); UtbmMain.Ribbon.Tabs.AddRange(new RibbonTab[] { RtData }); //RibbonGroup RibgCrud = new RibbonGroup("RibgCrud", "資料存取"); RibbonGroup RibgNav = new RibbonGroup("RibgNav", "導覽"); RibbonGroup RibgDecide = new RibbonGroup("RibgDecide", "處理"); RibbonGroup RibgExternal = new RibbonGroup("RibgExternal", "其他功能"); //視情況使用 放報表及Action //RtData.Groups.AddRange(new RibbonGroup[] { RibgCrud, RibgNav, RibgDecide }); RtData.Groups.AddRange(new RibbonGroup[] { RibgDecide, RibgNav, RibgExternal }); #endregion #region RtData/RibgDecide 相關按鈕 buttonKey = "BtOk"; var BtOk = new ButtonTool(buttonKey); //var BtOk = new ControlContainerTool(lsBtKey); UtbmMain.Tools.Add(BtOk); RibgDecide.Tools.AddTool(buttonKey); RibgDecide.Tools[buttonKey].InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; BtOk.SharedProps.AppearancesLarge.Appearance.Image = ilLarge.Images[GlobalPictuer.TOOLBAR_OK]; BtOk.SharedProps.Caption = "確認"; buttonKey = "BtCancel"; var BtCancel = new ButtonTool(buttonKey); UtbmMain.Tools.Add(BtCancel); RibgDecide.Tools.AddTool(buttonKey); RibgDecide.Tools[buttonKey].InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; BtCancel.SharedProps.AppearancesLarge.Appearance.Image = ilLarge.Images[GlobalPictuer.TOOLBAR_CANCEL]; BtCancel.SharedProps.Caption = "取消"; buttonKey = "BtClean"; var BtClean = new ButtonTool(buttonKey); UtbmMain.Tools.Add(BtClean); RibgDecide.Tools.AddTool(buttonKey); RibgDecide.Tools[buttonKey].InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; BtClean.SharedProps.AppearancesLarge.Appearance.Image = ilLarge.Images[GlobalPictuer.TOOLBAR_ERASER]; BtClean.SharedProps.Caption = "清除"; #endregion #region RtData/RibgNav 相關按鈕 if (IsMdiChild) //Mdi子視窗才有此功能 { buttonKey = "BtHome"; var BtHome = new ButtonTool(buttonKey); UtbmMain.Tools.Add(BtHome); RibgNav.Tools.AddTool(buttonKey); RibgNav.Tools[buttonKey].InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; //BtHome.SharedProps.AppearancesLarge.Appearance.Image = ilLarge.Images["home_32"]; BtHome.SharedProps.AppearancesLarge.Appearance.Image = ilLarge.Images[GlobalPictuer.TOOLBAR_HOME]; BtHome.SharedPropsInternal.Shortcut = Shortcut.CtrlH; BtHome.SharedProps.Caption = "主選單"; buttonKey = "BtFrmNavigator"; var BtFrmNavigateor = new ButtonTool(buttonKey); UtbmMain.Tools.Add(BtFrmNavigateor); RibgNav.Tools.AddTool(buttonKey); RibgNav.Tools[buttonKey].InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; //BtFrmNavigateor.SharedProps.AppearancesLarge.Appearance.Image = ilLarge.Images["form_navgiator_32"]; BtFrmNavigateor.SharedProps.AppearancesLarge.Appearance.Image = ilLarge.Images[GlobalPictuer.TOOLBAR_NAVGIATOR]; BtFrmNavigateor.SharedPropsInternal.Shortcut = Shortcut.CtrlW; BtFrmNavigateor.SharedProps.Caption = "切換視窗"; } #endregion #region RibgExternal 其他功能 buttonKey = "BtExit"; var BtExit = new ButtonTool(buttonKey); UtbmMain.Tools.Add(BtExit); RibgExternal.Tools.AddTool(buttonKey); RibgExternal.Tools[buttonKey].InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; BtExit.SharedProps.AppearancesLarge.Appearance.Image = ilLarge.Images[GlobalPictuer.TOOLBAR_EXIT]; //BtExit.SharedPropsInternal.Shortcut = Shortcut.CtrlF; BtExit.SharedProps.Caption = "離 開"; #endregion } catch (Exception ex) { throw ex; } }