public UcQueryResults() { InitializeComponent(); _stopwatch = new Stopwatch(); _isPinned = false; _sql = string.Empty; _isBusy = false; _maxResults = 100; _timingLabelTool = (LabelTool)_utm.Tools["Timing"]; _rowCountLabelTool = (LabelTool)_utm.Tools["Row Counts"]; _flagTool = (StateButtonTool)_utm.Tools["Flag"]; _showFilterTool = (StateButtonTool)_utm.Tools["Show Filter"]; _activityIndicatorTool = (ControlContainerTool)_utm.Tools["Activity Indicator"]; _stopButton = (ButtonTool)_utm.Tools["Stop"]; _exportToExcelTool = (ButtonTool)_utm.Tools["Export to Excel"]; _exportToCsvTool = (ButtonTool)_utm.Tools["Export to CSV"]; _exportToTextTool = (ButtonTool)_utm.Tools["Export to Text"]; _commitTool = (ButtonTool)_utm.Tools["Commit"]; _rollbackTool = (ButtonTool)_utm.Tools["Rollback"]; _fetchAllRowsTool = (ButtonTool)_utm.Tools["Fetch All Rows"]; _fetchMoreRowsTool = (ButtonTool)_utm.Tools["Fetch More Rows"]; _refreshQueryResultsTool = (ButtonTool)_utm.Tools["Refresh"]; _copyTool = (ButtonTool)_utm.Tools["Copy"]; _copyWithHeaders = (ButtonTool)_utm.Tools["Copy w/ Headers"]; _copyForSql = (ButtonTool)_utm.Tools["Copy for SQL IN Clause"]; _visualizedataTool = (ButtonTool)_utm.Tools["Visualize Data"]; _gridMenuTool = (PopupMenuTool)_utm.Tools["GridPopupMenu"]; _gridMenuTool.BeforeToolDropdown += (sender, args) => RefreshUserInterface(); RefreshUserInterface(); }
public FrmSqlWorksheet([NotNull] DatabaseConnection connection, [NotNull] string title, DatabaseInstance databaseInstance = null) { if (connection == null) { throw new ArgumentNullException("connection"); } if (title == null) { throw new ArgumentNullException("title"); } InitializeComponent(); _skipToolClickEvents = true; _sqlEditor.ActiveTextAreaControl.TextArea.AllowDrop = true; _sqlEditor.ActiveTextAreaControl.TextArea.DragEnter += TextArea_DragEnter; _sqlEditor.ActiveTextAreaControl.TextArea.DragOver += TextAreaDragOver; _sqlEditor.ActiveTextAreaControl.TextArea.DragDrop += SqlEditorOnDragDrop; DatabaseConnection = connection; DatabaseConnection.PropertyChanged += (sender, args) => RefreshUserInterface(); DatabaseInstance = databaseInstance; var maxResultsTextBoxTool = ((TextBoxTool)_utm.Tools["Max Results"]); maxResultsTextBoxTool.Text = connection.MaxResults.ToString(CultureInfo.InvariantCulture); maxResultsTextBoxTool.ToolKeyPress += (sender, e) => { if (!char.IsDigit(e.KeyChar)) { e.Handled = true; } }; maxResultsTextBoxTool.ToolValueChanged += (sender, args) => { int count; connection.MaxResults = !int.TryParse(maxResultsTextBoxTool.Text, out count) ? connection.MaxResults : count; }; _autoCommitTool = (StateButtonTool)_utm.Tools["Auto Commit"]; _autoCommitTool.Checked = connection.AutoCommit; _sqlEditor.Document.DocumentChanged += (sender, args) => IsModified = true; _sqlEditor.ActiveTextAreaControl.TextArea.KeyUp += SqlEditor_KeyUp; _sqlEditor.ActiveTextAreaControl.TextArea.KeyDown += SqlEditor_KeyDown; IntellisenseManager.Instance.LoadIntellisenseDataAsync(connection); Title = title; LoadHighlightingDefinitions(); FindUsableResultsTab(); LoadSettings(); _skipToolClickEvents = false; }
public void PublisherFilterChangedHandler(object sender, PublisherFilterEventArgs e) { // Set the toolbar state to mirror that passed to us StateButtonTool sbtShowIncluded = filtersRibbonGroup.Tools["network" + CommonToolNames.ViewIncluded] as StateButtonTool; sbtShowIncluded.Checked = e.ViewIncludedApplications; // StateButtonTool sbtShowIgnored = filtersRibbonGroup.Tools["network" + CommonToolNames.ViewIgnored] as StateButtonTool; sbtShowIgnored.Checked = e.ViewIgnoredApplications; }
private void RootTools_ToolAdded(object sender, ToolEventArgs args) { ITool tool = mCommandBarManager.RootTools[args.Key]; string[] toolNameSplit = tool.Key.Split('.'); string toolName = toolNameSplit[toolNameSplit.Length - 1]; if (toolName.ToUpper(System.Globalization.CultureInfo.InvariantCulture) == "NEW ADDIN") { //Addin button mAddinButton = (StateButtonTool)tool; mAddinButton.Checked = mAddinWindow.Visible; mAddinButton.ToolClick += new EventHandler(ShowAddin_ToolClick); } }
/// <summary> /// Initialize the toolbar items for the View Group /// </summary> private void InitializeFilterTools() { // Create a button tool for 'Filter Publishers' and add it to the Settings Group ButtonTool tool = new ButtonTool("applications" + CommonToolNames.FilterPublishers); tool.SharedProps.Caption = CommonToolNames.FilterPublishers; tool.SharedProps.ToolTipText = CommonToolNames.FilterPublishersTooltip; Image bgImage = Properties.Resources.filter_publishers_32; tool.SharedProps.AppearancesLarge.Appearance.Image = bgImage; ToolBase filterPublisherTool = WorkItem.UIExtensionSites[RibbonNames.filtersRibbonUISite].Add <ButtonTool>(tool); filterPublisherTool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; tool.ToolClick += new ToolClickEventHandler(filter_ToolClick); // Create StateButtons for 'View Included Applications' and 'View Ignored Applications' StateButtonTool viewIncludedTool = new StateButtonTool("applications" + CommonToolNames.ViewIncluded); viewIncludedTool.Checked = true; viewIncludedTool.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark; viewIncludedTool.ToolbarDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonToolbarDisplayStyle.Glyph; viewIncludedTool.SharedProps.Caption = CommonToolNames.ViewIncluded; viewIncludedTool.SharedProps.ToolTipText = CommonToolNames.ViewIncludedTooltip; bgImage = Properties.Resources.show_application_16; viewIncludedTool.SharedProps.AppearancesSmall.Appearance.Image = bgImage; viewIncludedTool.SharedProps.AppearancesLarge.Appearance.Image = bgImage; viewIncludedTool.ToolClick += new ToolClickEventHandler(filter_ToolClick); WorkItem.UIExtensionSites[RibbonNames.filtersRibbonUISite].Add <ButtonTool>(viewIncludedTool); // StateButtonTool viewIgnoredTool = new StateButtonTool("applications" + CommonToolNames.ViewIgnored); // The default for 'View Ignored' is 'true' for AuditWizard and 'False' for LicenseWizard #if _AUDITWIZARD_ viewIgnoredTool.Checked = true; #else viewIgnoredTool.Checked = false; #endif viewIgnoredTool.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark; viewIgnoredTool.ToolbarDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonToolbarDisplayStyle.Glyph; viewIgnoredTool.SharedProps.Caption = CommonToolNames.ViewIgnored; viewIgnoredTool.SharedProps.ToolTipText = CommonToolNames.ViewIgnoredTooltip; bgImage = Properties.Resources.hide_application_16; viewIgnoredTool.SharedProps.AppearancesSmall.Appearance.Image = bgImage; viewIgnoredTool.SharedProps.AppearancesLarge.Appearance.Image = bgImage; viewIgnoredTool.ToolClick += new ToolClickEventHandler(filter_ToolClick); WorkItem.UIExtensionSites[RibbonNames.filtersRibbonUISite].Add <ButtonTool>(viewIgnoredTool); }
/// <summary> /// This is the tool click handler for the Filters ribbon group /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void filter_ToolClick(object sender, ToolClickEventArgs e) { Cursor.Current = Cursors.WaitCursor; StateButtonTool sbt = null; ApplicationsWorkItemController controller = workItem.Controller as ApplicationsWorkItemController; switch (e.Tool.SharedProps.Caption) { case CommonToolNames.ViewIncluded: sbt = e.Tool as StateButtonTool; controller.ShowIncludedApplications = sbt.Checked; // Ensure that at least one option is selected StateButtonTool sbtShowIgnored = filtersRibbonGroup.Tools["applications" + CommonToolNames.ViewIgnored] as StateButtonTool; if (!sbt.Checked && !sbtShowIgnored.Checked) { sbtShowIgnored.Checked = true; } break; case CommonToolNames.ViewIgnored: sbt = e.Tool as StateButtonTool; controller.ShowIgnoredApplications = sbt.Checked; // Ensure that at least one option is selected StateButtonTool sbtShowIncluded = filtersRibbonGroup.Tools["applications" + CommonToolNames.ViewIncluded] as StateButtonTool; if (!sbt.Checked && !sbtShowIncluded.Checked) { sbtShowIncluded.Checked = true; } break; case CommonToolNames.FilterPublishers: controller.FilterPublishers(); break; default: break; } Cursor.Current = Cursors.Default; }
private void ShowAddin_ToolClick(object sender, EventArgs e) { StateButtonTool tool = (StateButtonTool)sender; string[] toolNameSplit = tool.Key.Split('.'); string toolName = toolNameSplit[toolNameSplit.Length - 1]; if (toolName.ToUpper(System.Globalization.CultureInfo.InvariantCulture) == "NEW ADDIN") { if (tool.Checked) { mAddinWindow.Show(); } else { mAddinWindow.Hide(); } } }
public UcExplainPlan() { InitializeComponent(); _stopwatch = new Stopwatch(); _isPinned = false; _isBusy = false; _timingLabelTool = (LabelTool)_utm.Tools["Timing"]; _flagTool = (StateButtonTool)_utm.Tools["Flag"]; _activityIndicatorTool = (ControlContainerTool)_utm.Tools["Activity Indicator"]; _stopButton = (ButtonTool)_utm.Tools["Stop"]; _refreshQueryResultsTool = (ButtonTool)_utm.Tools["Refresh"]; _copyTool = (ButtonTool)_utm.Tools["Copy"]; PopupMenuTool gridMenuTool = (PopupMenuTool)_utm.Tools["GridPopupMenu"]; gridMenuTool.BeforeToolDropdown += (sender, args) => RefreshUserInterface(); RefreshUserInterface(); }
/// <summary> /// This is the tool click handler for the Network->View ribbon group /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void view_ToolClick(object sender, ToolClickEventArgs e) { StateButtonTool sbt = null; NetworkWorkItemController controller = workItem.Controller as NetworkWorkItemController; switch (e.Tool.SharedProps.Caption) { case ToolNames.ShowStockAssets: sbt = e.Tool as StateButtonTool; controller.ShowStockAssets(sbt.Checked); break; case ToolNames.ShowInUseAssets: sbt = e.Tool as StateButtonTool; controller.ShowInUseAssets(sbt.Checked); break; case ToolNames.ShowPendingAssets: sbt = e.Tool as StateButtonTool; controller.ShowPendingAssets(sbt.Checked); break; case ToolNames.ShowDisposedAssets: sbt = e.Tool as StateButtonTool; controller.ShowDisposedAssets(sbt.Checked); break; case ToolNames.UserLocationsView: controller.DomainViewStyle = false; break; case ToolNames.DomainView: controller.DomainViewStyle = true; break; default: break; } }
public UcScriptResults() { InitializeComponent(); _stopwatch = new Stopwatch(); _isPinned = false; _sql = string.Empty; _isBusy = false; _maxResults = 100; _teScriptResults.IsReadOnly = true; _timingLabelTool = (LabelTool)_utm.Tools["Timing"]; _flagTool = (StateButtonTool)_utm.Tools["Flag"]; _activityIndicatorTool = (ControlContainerTool)_utm.Tools["Activity Indicator"]; _stopTool = (ButtonTool)_utm.Tools["Stop"]; _commitTool = (ButtonTool)_utm.Tools["Commit"]; _rollbackTool = (ButtonTool)_utm.Tools["Rollback"]; _copyTool = (ButtonTool)_utm.Tools["Copy"]; _saveTool = (ButtonTool)_utm.Tools["Save"]; _clearTool = (ButtonTool)_utm.Tools["Clear"]; RefreshUserInterface(); }
/// <summary> /// Initialize the tools on the 'Views' ribbon tab /// </summary> private void InitializeViewTools() { // Get the initial settings for teh various show flags from teh configuration bool showStock = false; bool showInUse = true; bool showPending = false; bool showDisposed = false; // Get the current 'show' flags Configuration config = ConfigurationManager.OpenExeConfiguration(Path.Combine(Application.StartupPath, "AuditWizardv8.exe")); try { showStock = Convert.ToBoolean(config.AppSettings.Settings["ShowStock"].Value); showInUse = Convert.ToBoolean(config.AppSettings.Settings["ShowInUse"].Value); showPending = Convert.ToBoolean(config.AppSettings.Settings["ShowPending"].Value); showDisposed = Convert.ToBoolean(config.AppSettings.Settings["ShowDisposed"].Value); } catch (Exception) { } // Create a button tool for 'User Locations View' ButtonTool userViewTool = new ButtonTool("network" + ToolNames.UserLocationsView); userViewTool.SharedProps.Caption = ToolNames.UserLocationsView; userViewTool.SharedProps.ToolTipText = ToolNames.UserLocationsTooltip; userViewTool.SharedProps.AppearancesLarge.Appearance.Image = Properties.Resources.location_32; userViewTool.ToolClick += new ToolClickEventHandler(view_ToolClick); ToolBase userViewToolInstance = WorkItem.UIExtensionSites[RibbonNames.viewRibbonUISite].Add <ButtonTool>(userViewTool); userViewToolInstance.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; // Create a button tool for 'Domain View' ButtonTool domainViewTool = new ButtonTool("network" + ToolNames.DomainView); domainViewTool.SharedProps.Caption = ToolNames.DomainView; domainViewTool.SharedProps.ToolTipText = ToolNames.DomainTooltip; domainViewTool.SharedProps.AppearancesLarge.Appearance.Image = Properties.Resources.domain32; domainViewTool.ToolClick += new ToolClickEventHandler(view_ToolClick); ToolBase domainViewToolInstance = WorkItem.UIExtensionSites[RibbonNames.viewRibbonUISite].Add <ButtonTool>(domainViewTool); domainViewToolInstance.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; // Create a button tool for 'Show Stock Assets' and add it to the Group StateButtonTool showStockTool = new StateButtonTool("network" + ToolNames.ShowStockAssets); showStockTool.Checked = showStock; showStockTool.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark; showStockTool.ToolbarDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonToolbarDisplayStyle.Glyph; showStockTool.SharedProps.Caption = ToolNames.ShowStockAssets; showStockTool.SharedProps.ToolTipText = ToolNames.ShowStockAssetsTooltip; showStockTool.SharedProps.AppearancesSmall.Appearance.Image = Properties.Resources.computer_stock_16; showStockTool.SharedProps.AppearancesLarge.Appearance.Image = Properties.Resources.computer_stock_16; WorkItem.UIExtensionSites[RibbonNames.viewRibbonUISite].Add <ButtonTool>(showStockTool); showStockTool.ToolClick += new ToolClickEventHandler(view_ToolClick); // Create a button tool for 'Show In Use Assets' and add it to the Group StateButtonTool showInUseTool = new StateButtonTool("network" + ToolNames.ShowInUseAssets); showInUseTool.Checked = showInUse; showInUseTool.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark; showInUseTool.ToolbarDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonToolbarDisplayStyle.Glyph; showInUseTool.SharedProps.Caption = ToolNames.ShowInUseAssets; showInUseTool.SharedProps.ToolTipText = ToolNames.ShowInUseAssetsTooltip; showInUseTool.SharedProps.AppearancesSmall.Appearance.Image = Properties.Resources.computer16; showInUseTool.SharedProps.AppearancesLarge.Appearance.Image = Properties.Resources.computer16; WorkItem.UIExtensionSites[RibbonNames.viewRibbonUISite].Add <ButtonTool>(showInUseTool); showInUseTool.ToolClick += new ToolClickEventHandler(view_ToolClick); // Create a button tool for 'Show Pending Disposal Assets' and add it to the Group StateButtonTool showPendingTool = new StateButtonTool("network" + ToolNames.ShowPendingAssets); showPendingTool.Checked = showPending; showPendingTool.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark; showPendingTool.ToolbarDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonToolbarDisplayStyle.Glyph; showPendingTool.SharedProps.Caption = ToolNames.ShowPendingAssets; showPendingTool.SharedProps.ToolTipText = ToolNames.ShowPendingAssetsTooltip; showPendingTool.SharedProps.AppearancesSmall.Appearance.Image = Properties.Resources.computer_pending_16; showPendingTool.SharedProps.AppearancesLarge.Appearance.Image = Properties.Resources.computer_pending_16; WorkItem.UIExtensionSites[RibbonNames.viewRibbonUISite].Add <ButtonTool>(showPendingTool); showPendingTool.ToolClick += new ToolClickEventHandler(view_ToolClick); // Create a button tool for 'Show Disposed Assets' and add it to the Group StateButtonTool showDisposedTool = new StateButtonTool("network" + ToolNames.ShowDisposedAssets); showDisposedTool.Checked = showDisposed; showDisposedTool.MenuDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonMenuDisplayStyle.DisplayCheckmark; showDisposedTool.ToolbarDisplayStyle = Infragistics.Win.UltraWinToolbars.StateButtonToolbarDisplayStyle.Glyph; showDisposedTool.SharedProps.Caption = ToolNames.ShowDisposedAssets; showDisposedTool.SharedProps.ToolTipText = ToolNames.ShowDisposedAssetsTooltip; showDisposedTool.SharedProps.AppearancesSmall.Appearance.Image = Properties.Resources.computer_disposed_16; showDisposedTool.SharedProps.AppearancesLarge.Appearance.Image = Properties.Resources.computer_disposed_16; WorkItem.UIExtensionSites[RibbonNames.viewRibbonUISite].Add <ButtonTool>(showDisposedTool); showDisposedTool.ToolClick += new ToolClickEventHandler(view_ToolClick); }
private void RootTools_ToolAdded(object sender, ToolEventArgs args) { ITool tool = mCommandBarManager.RootTools[args.Key]; string[] toolNameSplit = tool.Key.Split('.'); string toolName = toolNameSplit[toolNameSplit.Length - 1]; if (toolName.ToUpper(System.Globalization.CultureInfo.InvariantCulture) == "NEW ADDIN") { //Addin button mAddinButton = (StateButtonTool)tool; mAddinButton.Checked = mAddinWindow.Visible; mAddinButton.ToolClick +=new EventHandler(ShowAddin_ToolClick); } }
private void prcInitializeRibbon() { string strCaption = "Initializing Ribbon"; try { //Configure Ribbon this.toolMan.Ribbon.Visible = true; this.toolMan.DockWithinContainer = this; this.toolMan.DockWithinContainerBaseType = typeof(System.Windows.Forms.Form); //Setup Style Of Ribbon toolMan.Style = Infragistics.Win.UltraWinToolbars.ToolbarStyle.Office2010; toolMan.Ribbon.FileMenuStyle = Infragistics.Win.UltraWinToolbars.FileMenuStyle.ApplicationMenu2010; //ImageList this.toolMan.ImageListLarge = ilLarge; this.toolMan.ImageListSmall = ilSmall; // Create Basic Ribbon Tab foreach (DataRow dr in dsMaster.Tables["Module"].Rows) { strCaption = "Creating Tab"; RibbonTab rt = new RibbonTab(dr["moduleId"].ToString(), dr["moduleCaption"].ToString()); this.toolMan.Ribbon.Tabs.Add(rt); } //Creating Ribbon Group foreach (DataRow dr in dsMaster.Tables["Group"].Rows) { strCaption = "Creating Group"; RibbonGroup rg = new RibbonGroup(dr["mMenuGroupId"].ToString(), dr["mMenuGroupCaption"].ToString()); this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups.Add(rg); } #region Creating Button //Creating Button foreach (DataRow dr in dsMaster.Tables["Menu"].Rows) { strCaption = "Creating Button : " + dr["MenuCaption"].ToString(); #region Form Based Button if (Int16.Parse(dr["isFormBased"].ToString()) != 0) { ButtonTool btn = new ButtonTool(dr["menuId"].ToString()); btn.SharedProps.Caption = dr["menuCaption"].ToString(); if (Int16.Parse(dr["menuImageExist"].ToString()) == 0) { //Picture does not Exist for menu this.toolMan.Tools.Add(btn); this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools.Add(btn); } else { //Picture Exist for menu alMenuImage.Add(dr["menuId"].ToString()); //Picture Exist for menu prcFillImageList(dr["menuImageName"].ToString(), Int16.Parse(dr["menuImageSize"].ToString())); Common.Classes.clsMain.alMnuFrmName.Add(dr["frmName"].ToString()); if (Int16.Parse(dr["menuImageSize"].ToString()) != 2) { //Small Image btn.SharedProps.AppearancesSmall.Appearance.Image = alMenuImage.Count - 1;//Common.Classes.clsMain.alMnuFrmName.Count - 1; } else { //Large Image btn.SharedProps.AppearancesLarge.Appearance.Image = alMenuImage.Count - 1; } btn.SharedProps.DisplayStyle = ToolDisplayStyle.TextOnlyInMenus; #region Normal Menu [No DropDown Menu] if (Int16.Parse(dr["IsDropDown"].ToString()) == 0) { this.toolMan.Tools.Add(btn); //Set Large Image for tool ToolBase tb = this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools.AddTool(dr["MenuId"].ToString()); tb.CustomizedCaption = dr["menuCaption"].ToString(); if (Int16.Parse(dr["menuImageSize"].ToString()) == 2) { tb.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; } } #endregion Normal Menu [No DropDown Menu] #region DropDown Menu if (Int16.Parse(dr["IsDropDown"].ToString()) == 1) { if (Int16.Parse(dr["DropDownParentId"].ToString()) == 0) { Infragistics.Win.Appearance ap1 = new Infragistics.Win.Appearance(); ap1.Image = alMenuImage.Count - 1; PopupMenuTool pmt = new PopupMenuTool(dr["menuId"].ToString()); pmt.DropDownArrowStyle = DropDownArrowStyle.Segmented; pmt.SharedPropsInternal.Caption = dr["menuCaption"].ToString(); pmt.SharedPropsInternal.Category = "DROPDOWNPARENT"; //Used to stop working when click on the main menu pmt.SharedPropsInternal.ToolTipText = "Select menu from list"; pmt.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; //Setup Appearance pmt.SharedPropsInternal.AppearancesSmall.Appearance = ap1; toolMan.Tools.Add(pmt); toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools.AddTool(pmt.Key.ToString()); } else { StateButtonTool sbt = new StateButtonTool(dr["menuId"].ToString()); sbt.SharedPropsInternal.Caption = dr["menuCaption"].ToString(); sbt.CustomizedImage = ilSmall.Images[alMenuImage.Count - 1]; toolMan.Tools.Add(sbt); ((PopupMenuTool)(this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools[dr["DropdownParentId"].ToString()])).Tools.AddRange(new ToolBase[] { sbt }); } } #endregion DropDown Menu } } #endregion Form Based Button #region Combo Button if ((dr["ContainerType"]).ToString() == "Combo") { //Crate Combobox tool ComboBoxTool cbo = new ComboBoxTool("cbo" + dr["menuName"].ToString()); //Create ValueList For Loading Combo Data ValueList valueList1 = new ValueList(0); valueList1.DisplayStyle = Infragistics.Win.ValueListDisplayStyle.DisplayText; valueList1.PreferredDropDownSize = new System.Drawing.Size(0, 0); string strDefault = ""; foreach (DataRow dr3 in dsMaster.Tables["Company"].Rows) { if (Int16.Parse(dr3["isDefault"].ToString()) != 0) { strDefault = dr3["comId"].ToString(); } ValueListItem v1 = new ValueListItem(); v1.DataValue = dr3["comId"].ToString(); v1.DisplayText = dr3["comName"].ToString(); valueList1.ValueListItems.Add(v1); } cbo.ValueList = valueList1; this.toolMan.Tools.AddRange(new ToolBase[] { cbo }); ToolBase tbCompany = this.toolMan.Ribbon.Tabs[dr["moduleId"].ToString()].Groups[dr["mMenuGroupId"].ToString()].Tools.AddTool(cbo.Key); //ToolBase tbCompany = ((RibbonGroup)dr["mMenuGroupId"]).Tools.AddTool(cbo.Key); //Set Default Value if (strDefault.Length > 0) { ((ComboBoxTool)toolMan.Tools[cbo.Key]).Value = Int16.Parse(strDefault); } } #endregion Combo Button } #endregion Creating Button } catch (Exception ex) { MessageBox.Show(ex.Message, strCaption); } }
/// <summary> /// This is a helper method to create a button tool with the specified key, caption and image index. /// </summary> /// <param name="key">Key of the tool to create</param> /// <param name="caption">Caption of the button tool</param> /// <param name="smallImage"></param> /// <param name="largeImage"></param> /// <returns>The tool instance created</returns> private ButtonTool createButtonTool(string key, string caption, Bitmap smallImage, Bitmap largeImage) { var btn = new StateButtonTool(key); btn.SharedProps.Caption = caption; if (smallImage != null) btn.SharedProps.AppearancesSmall.Appearance.Image = smallImage; if (largeImage != null) btn.SharedProps.AppearancesLarge.Appearance.Image = largeImage; btn.InstanceProps.MinimumSizeOnRibbon = RibbonToolSize.Large; btn.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; //btn.InstanceProps.Width = 150; //btn.InstanceProps.MinWidth = 50; ultraToolbarsManager1.Tools.Add(btn); return btn; }