Responder Overview > Application Framework - Responder > Commands in Responder > Add Responder Command to User Interface |
You may add a custom command or control to your user interface using a custom layout XML file. The sample XML on this page demonstrates how to add both sample commands discussed in this section.
The following XML is required to add a custom command to the user interface. Each custom command requires a <Command> tag.
XML Example |
Copy Code
|
---|---|
<?xml version="1.0" encoding="us-ascii"?> <LayoutData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layoutFormat="2"> <MainWindow> <CommandManager> <Commands> <Command key="TestCmd" type="CommandTest.CommandButtonTest, CommandTest" /> </Commands> <CommandBars> <CommandBar key="mainToolbar" type="Miner.Responder.Windows.CommandBarMainToolbar, Miner.Responder.Windows, Version=9.2.0.0, Culture=neutral, PublicKeyToken=196beceb052ed5dc"> <CommandItems> <CommandItem key="TestCmd" /> </CommandItems> </CommandBar> </CommandBars> </CommandManager> </MainWindow> </LayoutData> |
The <CommandManager> tag contains all commands, commandbars, and option sets. If this tag already exists in your Custom Layout file, add your custom command(s) to it.
The <Commands> tag contains all custom commands. If this tag already exists, add your custom command to it.
A <Command> tag must exist for each custom command you wish to add to the user interface. The <Command> tag contains the following attributes:
Key Value in the Button Command Example |
Copy Code
|
---|---|
public const string _Cmdkey = "TestCmd"; |
You may add tools to a toolbar (or commandbar) using a custom layout file. Refer to the Customize Toolbars page for more information. The custom layout file must reside in Responder\Client\addons\Miner.Responder.Explorer or Responder\Client\addons\Miner.Responder.ArchiveExplorer.
The .dlls for custom commands must reside in the Responder\Client directory with the application executable (Miner.Responder.Explorer.exe or Miner.Responder.ArchiveExplorer.exe). They do not require the RegX (or Regasm) utility.
ControlStylesConfig.xml and ArchiveStylesConfig.xml
ControlStylesConfig.xml resides on the Responder Server machine (e.g., Miner and Miner\Responder\Server\) and supports Responder Explorer. ArchiveStylesConfig.xml resides in the same location, but provides support for Archive Explorer.
Context menu (or right click) commands must be added to the appropriate configuration file, depending upon whether you're adding a right-click command to Responder Explorer or Archive Explorer. This allows you to designate the dockable window in which the your custom context menu command appears (e.g., Crews tab, Dispatchers tab, Alerts tab, etc.). Custom right-click commands must be added to the appropriate StylesConfig file as well as a custom layout file as discussed above.
To find the various user interface components, look for the ControlStyle tag. The Key attribute indicates the component. For example: <ControlStyle Key="AlertsGrid"> is the Alerts grid. Each <ControlStyle> tag has a comment tag on the next line that provides a description of the user interface component.
Sample Description for Crew Tree |
Copy Code
|
---|---|
<ControlStyle Key="CrewTree" ResourceAssembly="Miner.Responder.Windows"> <!--tree displaying crews--> |
Once you've identified the portion of the user interface to which you want to add your custom context menu command, look for the <Commands> tag within that section. You will need to add a <Command> tag that references your custom command. The following example adds the sample context menu command from this section (Show_Crew_Incidents) as a right-click item on the Crews tab.
Add Context Menu Command to Crews Tab |
Copy Code
|
---|---|
<ControlStyle Key="CrewTree" ResourceAssembly="Miner.Responder.Windows"> <!--tree displaying crews--> <Commands Key="CrewTree_Commands"> <Command Key="Show_Crew_Incidents"/> </Commands> |