Making Your Own Plugin
The plugin framework in HH Timing was created to allow users to implement their own custom logic in the software.
HH Timing has been created using the .Net Framework and so plugins can be created using any .Net Framework language (C# or VB.Net for example).
The user interface of HH Timing was developed using WinForms and so any user interface elements in a plugin must also be developed using WinForms.
Currently the plugin framework allows you to:
- Create a custom tab in the ribbon bar to gain access to the plugin
- Create a display and receive timing data from the software in the form of “messages”
- Create and save items in the project in the software
- Create “data importers” for importing CSV, PDF and other static files
- Create “message parsers” to read data from a timing feed over a network connection, from an HTML web page or from an FTP server
- Access the project database using Entity Framework – note this requires an additional reference to the relevant Entity Framework libraries
Creating a plugin
To create a plugin you must have the following programs installed on your computer:
- .NET Framework 4.7.1 or higher (this will already be installed on your computer if you already have HH Timing installed)
- The latest version of HH Timing
- The latest version of Visual Studio 2017
Create a new Visual Studio project, and ensure that you target the .Net Framework 4.7.1 (please note this is not necessarily the default setting when you create a new project depending on which version of Visual Studio you are using). It is okay to target a .Net Framework version below 4.7.1, but your plugin will not load correctly if you target a version above 4.7.1.
You must add references to four HH Timing dlls to start creating your plugin:
- HHTiming.WinFormsControls.dll can also be added as a reference if you wish to extend any of the basic HH Timing controls. If you need support understanding any of these controls we can send further information or arrange a web meeting as required.
These files are located in the installation directory of the software which by default is C:\Program Files (x86)\HH Development\HH Timing.
Please ensure that the CopyLocal flag is set to false for these references.
In the HHTiming.Desktop.Definitions.PlugInFramework namespace the interface IHHTimingPlugin interface is defined. The IHHTimingPlugin interface is the entry point for your plugin to be used in HH Timing. Your plugin must contain one class that implements this interface for it to be loaded into the software.
Once the IHHTimingPlugin interface has been correctly implemented you can begin writing your own components for HH Timing.
Some other interfaces that are important to understand when writing an HH Timing plugin are:
- IWorksheetControl: each display that is shown in a workbook of HH Timing is shown as a “worksheet”. To be displayed in a worksheet, a UserControl must implement the IWorksheetControl interface.
- IUIUpdateControl: in HH Timing all the processed live data is sent to controls using a messaging system. Each message implements the IUIUpdateMessage interface. The messages are broadcast to each registered IUIUpdateControl. The IUIUpdateControls can also request certain initialization messages from the database (e.g. all lap and sector times for a particular car). All of the IUIUpdateMessage implementations are contained in HHTiming.Core.Definitions.dll
- IProjectObject: each object that is saved to the project must implement the IProjectObject interface. Most importantly, this interface exposes Save and Load functions.
Debugging your plugin
Your plugin can only run as part of HH Timing and so you should set the debug start action to launch HH Timing. To do this right-click on your Visual Studio project and select Properties. On the Debug tab set the appropriate start action as shown in the following image:
The path should be the installation path of HH Timing, which by default is: C:\Program Files (x86)\HH Development\HH Timing\HH Timing.exe
Now you can use the "Start" button in Visual Studio to debug your plugin.
Your plugin must be in Document/HH TIming/plugin
To do this right-click on your Visual Studio project and select Properties. On the Build Events tab, in the Post-build Event Command Line enter the following code (Don't forget to replace MyPlugin by your plugin name):
if $(ConfigurationName) == Debug if not exist "$(registry:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders@Personal)\HH Timing\Plugins\MyPlugin" mkdir "$(registry:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders@Personal)\HH Timing\Plugins\MyPlugin"<br> if $(ConfigurationName) == Debug copy /y "$(TargetDir)" "$(registry:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders@Personal)\HH Timing\Plugins\MyPlugin
Using your plugin
If you didn't set up build even, you will have to place the zipped plugin folder (no need to unzip) in the following directory:
When you start the software the plugin will appear in its own tab in the ribbon bar.
Drive Time Plugin: the Drive Time Plugin was developed for use by teams competing in the GT World Challenge Endurance and provides some additional functionality to help with managing the driving time, stint time and pit stop length regulations.
Sample plugin source code can be found on our Github account.
Updating your plugin to .net 7 (HH Timing 0.7)
You can look at our Github account (Drive Time Plugin for example) to know how to move your code to .net7. If you need any help, do not hesitate to contact us.
There are many steps:
- Update Assembly
<?xml version="1.0" encoding="utf-8"?>)
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">by
Delete all PropertyGroup nodes.
Add the following PropertyGroup nodes:
Delete all other ItemGroup nodes.
Add Target node (replace PluginName with your pluginName):
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Exec Command="if $(Configuration) == Debug if not exist "$(registry:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders@Personal)\HH Timing\Plugins\PluginName" mkdir "$(registry:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders@Personal)\HH Timing\Plugins\PluginName"
if $(Configuration) == Debug copy /y "$(TargetDir)" "$(registry:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders@Personal)\HH Timing\Plugins\PluginName"" /></Target>