Skip to content

Instantly share code, notes, and snippets.

@hasokeric
Last active December 20, 2020 14:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save hasokeric/80534d734d13f431b713045a9dca4f32 to your computer and use it in GitHub Desktop.
Save hasokeric/80534d734d13f431b713045a9dca4f32 to your computer and use it in GitHub Desktop.
Haso-Epicor-ToolsAdd-Sample

UltraToolbar

1 = MainMenu
2 = Standard Tools
3 = Navigation Toolbar

PopupMenuTool

1 = FileMenu
2 = EditMenu
3 = ViewMenu
4 = FavoritesMenu
5 = ToolsMenu
6 = ActionsMenu
7 = HelpMenu
8 = NewMenuTool
9 = SaveMenuTool
10 = FileMenu
11 = EditMenu
12 = HelpMenu
13 = ToolsMenu
14 = NewMenuTool
15 = ViewMenu
16 = FavoritesMenu
17 = ActionsMenu
18 = SaveMenuTool

ButtonTool

1 = NewTool
2 = SaveTool
3 = DeleteTool
4 = PrintTool
5 = PrintPreviewTool
6 = CutTool
7 = CopyTool
8 = PasteTool
9 = UndoTool
10 = PrimarySearchTool
11 = NewTool
12 = SaveTool
13 = DeleteTool
14 = PrintTool
15 = PrintPreviewTool
16 = ExitTool
17 = UndoTool
18 = CutTool
19 = CopyTool
20 = PasteTool
21 = AboutTool
22 = NewTool
23 = SaveTool
24 = DeleteTool
25 = ExitTool
26 = CutTool
27 = CopyTool
28 = PasteTool
29 = AboutTool
30 = PrintTool
31 = PrintPreviewTool
32 = SaveCustomTool
33 = TransUIUtilTool
34 = RefreshTranslationTool
35 = OptionsTool
36 = ResetLayoutsTool
37 = SaveCustomTool
38 = logoTool
39 = TransUIUtilTool
40 = RefreshTranslationTool
41 = OptionsTool
42 = PrimarySearchTool
43 = ResetLayoutsTool
44 = UndoTool
private void SetupToolbarItems()
{
// Get The Main Toolbar
UltraToolbar mainToolBar = this.baseToolbarsManager.Toolbars["Standard Tools"];
// Remove the Single NewTool Button from the Toolbar Root
mainToolBar.Tools.Remove(mainToolBar.Tools["NewTool"]);
// Make Epicors Popup Tool NewMenuTool Visibile (most forms have this hidden by default)
baseToolbarsManager.Tools["NewMenuTool"].SharedProps.Visible = true;
// Hide the Save Button since we will not allow Saving
baseToolbarsManager.Tools["SaveTool"].SharedProps.Visible = false;
// Hide the Delete Tool since will not allow Deleting
baseToolbarsManager.Tools["DeleteTool"].SharedProps.Visible = false;
// Hide the Search Tool since we will not allow Searching
//baseToolbarsManager.Tools["SearchTool"].SharedProps.Visible = false;
// Make others Visible or Invisible
baseToolbarsManager.Tools["PrintTool"].SharedProps.Visible = true;
// Remove these Items from the Toolbar but not from the Actions Menu
string[] arMainTools = new string[6] {"CutTool", "RefreshTool", "CopyTool", "PasteTool", "UndoTool", "AttachmentTool"};
foreach (string tool in arMainTools)
{
mainToolBar.Tools.Remove(mainToolBar.Tools[ tool ]);
}
// WIP: Skids
Infragistics.Win.UltraWinToolbars.ComboBoxTool comboSkidCountTool = new Infragistics.Win.UltraWinToolbars.ComboBoxTool("SkidCount");
Infragistics.Win.UltraWinToolbars.LabelTool skidToolLbl = new Infragistics.Win.UltraWinToolbars.LabelTool("SkidCountLabel");
skidToolLbl.SharedProps.Caption = "Skids: ";
skidToolLbl.SharedProps.AppearancesSmall.Appearance.TextHAlign = Infragistics.Win.HAlign.Right;
skidToolLbl.SharedProps.MinWidth = 50;
skidToolLbl.SharedProps.Width = 50;
skidToolLbl.SharedProps.MaxWidth = 50;
// Show 32 Skids
for (int i = 1; i < 33; i++)
{
comboSkidCountTool.ValueList.ValueListItems.Add( i );
}
comboSkidCountTool.SharedProps.MinWidth = 40;
comboSkidCountTool.SharedProps.Width = 40;
comboSkidCountTool.SharedProps.MaxWidth = 40;
comboSkidCountTool.SharedProps.AppearancesSmall.Appearance.TextHAlign = Infragistics.Win.HAlign.Left;
comboSkidCountTool.SharedProps.Caption = "Skids:";
comboSkidCountTool.SelectedIndex = 1;
comboSkidCountTool.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList;
//comboSkidCountTool.Value = "<Select a comnposer>";
comboSkidCountTool.SharedProps.ToolTipText = "How Many Skids Do You Need?";
comboSkidCountTool.AutoComplete = true;
comboSkidCountTool.SharedProps.AppearancesSmall.Appearance.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("Material")];
//
// Modify the Existing NewTool
//
baseToolbarsManager.Tools["NewTool"].SharedProps.Caption = "New Design";
//
// Create a Add Label Button
//
Infragistics.Win.UltraWinToolbars.ButtonTool NewLabelToolItem = new Infragistics.Win.UltraWinToolbars.ButtonTool("NewLabel");
NewLabelToolItem.SharedProps.Caption = "Add Label";
NewLabelToolItem.SharedProps.Enabled = true;
NewLabelToolItem.SharedProps.Visible = true;
NewLabelToolItem.SharedProps.AppearancesSmall.Appearance.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("Material")];
//
// Create a Print Button
//
Infragistics.Win.UltraWinToolbars.ButtonTool PrintToolItem = new Infragistics.Win.UltraWinToolbars.ButtonTool("PrintTool2");
PrintToolItem.SharedProps.Caption = "Print Labels";
PrintToolItem.SharedProps.Enabled = true;
PrintToolItem.SharedProps.Visible = false;
PrintToolItem.SharedProps.AppearancesSmall.Appearance.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("Print")];
// Register our Buttons with the Base Toolbars Manager
//baseToolbarsManager.Tools.Add(NewLabelToolItem);
baseToolbarsManager.Tools.Add(PrintToolItem);
baseToolbarsManager.Tools.Add(skidToolLbl);
baseToolbarsManager.Tools.Add(comboSkidCountTool);
// Add the NewLabel Button also to the Root Toolbar
//baseToolbarsManager.Toolbars["Standard Tools"].Tools.AddTool("NewLabel");
mainToolBar.Tools.AddTool("SkidCountLabel");
mainToolBar.Tools.AddTool("SkidCount");
// Add the Buttons to our Popup (DropDown) New Button Group
((Infragistics.Win.UltraWinToolbars.PopupMenuTool)baseToolbarsManager.Tools["NewMenuTool"]).Tools.AddTool("NewTool");
//((Infragistics.Win.UltraWinToolbars.PopupMenuTool)baseToolbarsManager.Tools["NewMenuTool"]).Tools.AddTool("NewLabel");
((Infragistics.Win.UltraWinToolbars.PopupMenuTool)baseToolbarsManager.Tools["NewMenuTool"]).Tools.AddTool("SkidCount");
}
Infragistics.Win.UltraWinToolbars.PopupMenuTool PopMenuTools = (Infragistics.Win.UltraWinToolbars.PopupMenuTool)baseToolbarsManager.Tools["ToolsMenu"];
foreach (ToolBase tool in PopMenuTools.Tools)
{
//toolNames+="Tool Name: "+tool.Key+
//"\t\tTool Type: "+tool.GetType().Name+"\n";
}
// PSEUDO-CODE:
// loop thru UltraToolbars (MainMenu, Standard Tools, Navigation Toolbar
foreach {
// loop thru PopupMenuTool
foreach {
// loop thru ButtonTools
foreach {
// Code Here
}
}
}
@pmalicki11
Copy link

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment