Configuring a Module to Load a User Interface Customization File
- Last UpdatedJun 02, 2022
- 2 minute read
Each Common Application Framework (CAF) based application has an Extensible Markup Language (XML) configuration file which contains a list of User Interface Customization (UIC) files that the application should load at start-up. The default location for this file is in the same directory as the application executable. It has a filename of the form <Module Name>Customisation.xml. By default the UIC files are also expected to be in the same directory as the application executable. You can however specify the full path to the UIC file including the use of UNC pathnames. It is also possible to define a project specific UIC file. The string "$1" in the UIC path will be replaced with the current project name.
If during addin development you do not wish to modify the customization configuration file in the install directory (this is particularly likely to be the case if you are using a server based installation) then the default location of the customization configuration file can be overridden using the environment variable CAF_UIC_PATH. You can then edit a copy of the file and point this environment variable at the directory you copy it to.
<?xml version="1.0" encoding="utf-8" ?>
<UICustomizationSet xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DefaultIcon>AvevaSharedIcons:ID_WARNING</DefaultIcon>
<UICustomizationFiles>
<CustomizationFile Name="Module" Path="design.uic" />
<CustomizationFile Name="SchematicExplorerAddin" Path="CoreSchematicMenu.uic" />
<CustomizationFile Name="Project" Path="$1.uic" Optional="true" />
<CustomizationFile Name="SVGCompare" Path="SVGCompare.uic" />
<CustomizationFile Name="Cabling" Path="AVEVA.design.cabling.uic" />
<CustomizationFile Name="Hvac" Path="AVEVA.design.hvac.uic" />
<CustomizationFile Name="Supports" Path="AVEVA.design.MDS.uic" />
<CustomizationFile Name="Piping" Path="AVEVA.design.piping.uic" />
<CustomizationFile Name="Steelwork" Path="AVEVA.design.steelwork.uic" />
<CustomizationFile Name="MessageAddin" Path="MessageWindowCoreMenus.uic" />
<CustomizationFile Name="Laser" Path="AVEVA.design.laser.uic" />
<CustomizationFile Name="Integrator" Path="Integrator.uic" />
<CustomizationFile Name="DiagramViewer" Path="DiagramViewer.uic" />
<CustomizationFile Name="InstrumentationImportAddin" Path="InstrumentationImportAddin.uic" />
</UICustomizationFiles>
</UICustomizationSet>
The order of the UIC files in this configuration file is significant. They are loaded in order since it is possible for a UIC file to define a tool which is hosted in a menu or on a commandbar defined in a UIC file already loaded.
A new UIC file can be added to a module simply by adding a new line to the corresponding customization configuration file. The actual content of the UIC file will be created using the interactive user interface customization tool described below.
As well as adding to the customization configuration file, an addin can also load a UIC file directly using the AddUICustomisationFile method of the CommandBarManager.
// Load a UIC file for the AttributeBrowser.
ICommandBarManager commandBarManager = dependencyResolver.GetImple\-mentationOf<ICommandBarManager>();
commandBarManager.AddUICustomisationFile("AttributeBrowser.uic", "AttributeBrowser");
This UIC file will be loaded before those define in the Customization configuration file, so it must create its own menu or commandbar to host its tools.