Can't access MainController Toolbar

Trying to access a toolbar click even through this line of code in 10.2.700.
Added
using Infragistics.Win.UltraWinGrid;
using System.Collections.Generic;

	public void ToolBarClick(string tool)
    {        
		MainController.AppControlPanel.HandleToolClick(tool, new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools[tool], null));   
	}

Keeps kicking out this error though.
The name ‘MainController’ does not exist in the current context
This is in 10.2.700. Did the syntax change for this possibly?

You are doing this on a Customization Layer right, not within the Dashboard Customization of a Tracker.

Correct. Customization of Quote Entry

Well MainController is for Dashboards only. What are you trying to do on Quote Entry?

Handle the Tool Click or Click the Tool?

Click the tool. I’ve used this in non dashboard screens before though.

Can’t be because the MainController is the Form name… for example in the Part Form it would be PartForm and in the Quote Form it will be QuoteForm or QuoteFormEntry – can’t recall.

The only way I know how to perform the click of the button is by using reflection

// Example of MasterPackPrintForm - you would change that to QuoteForm
MethodInfo mi = typeof(EpiBaseForm).GetMethod("handleToolClick", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(MasterPackPrintForm, new object[]{"PrintClientTool",new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MasterPackPrintForm.MainToolManager.Tools["RefreshTool"],null)});

OR

// Kind of Cheating, does not seem to work in MES, but works in Dashboards and Epicor
baseToolbarsManager.Tools["RefreshTool"].SharedProps.Shortcut = (Shortcut)Shortcut.ShiftF9;
SendKeys.Send("+{F9}");

But rarely is it being used since you can always invoke stuff with

oTrans.Refresh();
oTrans.Update();


Another Ref by Jose

2 Likes

Thanks. I must have been misremembering.

I couldn’t get oTrans.Update() to work. Then I realized I didn’t clear my cache after updating my code. Got me on a 3 hour sidetrack.

Appreciate your time. Helped get my head straight.