Acuit Pinpoint Workstation Plug-ins Overview
Acuit Pinpoint Workstation plug-ins are Microsoft .NET class libraries that are dynamically loaded by Acuit Pinpoint Workstation into its process. Plug-ins can then integrate with the Acuit Pinpoint Workstation workflow by subscribing to various .NET events that are published by Acuit Pinpoint Workstation and by registering user interface components to appear within the Acuit Pinpoint Workstation user interface in various well-defined regions.
Warning
The following details apply to Acuit Pinpoint Workstation version 7. Some changes to the next version of Acuit Pinpoint Workstation will require changes to existing plug-ins.
Microsoft .NET Framework
Acuit Pinpoint Workstation uses Microsoft .NET Framework version 4.7.2. Plug-ins must be compiled to use .NET Framework version 4.7.2 or earlier. Examples in this documentation use C#, but any supported .NET language may be used.
Windows Presentation Foundation (WPF)
Acuit Pinpoint Workstation uses WPF for its user interface. Plug-ins that provide any user interface components must use WPF to build these components.
While it is recommended that plug-ins use WPF for their UI, it is possible to develop UI components as Windows Forms controls or forms and integrate them into WPF using interoperation mechanisms provided by WPF. See https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/wpf-and-windows-forms-interoperation for information.
Acquiring Dependencies
The packages necessary for developing workstation plug-ins are published via the NuGet package manager. Various packages related to Acuit Pinpoint are available, but the primary package needed for developing plug-ins for Acuit Pinpoint Workstation is Acuit.Pinpoint.Workstation.Interfaces.
Simply add a reference to this package within your Visual Studio project to obtain everything needed to integrate with Acuit Pinpoint Workstation.
Note
Remember that the version of the Acuit.Pinpoint.Workstation.Interfaces package that you reference in your project determines the minimum version of Acuit Pinpoint Workstation that will be required to host your plug-in.
Modularity via Prism and MEF
Acuit Pinpoint Workstation uses the Prism 4.1 framework and Managed Extensibility Framework (MEF) to support modularity and its composable user interface. Plug-ins must use these mechanisms to participate in this framework.
At its core, a workstation plug-in is simply a Prism module, which is a class within a class library that implements the IModule interface and is decorated with ModuleExportAttribute. Note that a class library can contain multiple plug-in modules, though this is not common.
For example:
[ModuleExport("ExamplePlugIn", typeof(PlugInModule))]
public class PlugInModule : IModule
{
public void Initialize()
{
// Initialize the plug-in module here
}
}
When the plug-in module's Initialize method is called, it should integrate itself into the Acuit Pinpoint Workstation workflow and user interface by subscribing to events or registering user interface components.
Dependency Injection
Plug-ins integrate with Acuit Pinpoint Workstation through interfaces, and they obtain the interfaces that they need via dependency injection (provided by Prism and MEF). For example, the module above could monitor when units are scanned or released at the station via events provided by the IWorkstationService interface, obtained and used like this:
[ModuleExport("ExamplePlugIn", typeof(PlugInModule))]
public class PlugInModule : IModule
{
private readonly IWorkstationService _WorkstationService;
[ImportingConstructor]
public PlugInModule(IWorkstationService workstationService)
{
_WorkstationService = workstationService;
}
public void Initialize()
{
_WorkstationService.UnitScanned += WorkstationService_UnitScanned;
_WorkstationService.UnitReleased += WorkstationService_UnitReleased;
}
void WorkstationService_UnitScanned(object sender, UnitScanEventArgs e)
{
// React to unit scan...
}
void WorkstationService_UnitReleased(object sender, UnitReleaseEventArgs e)
{
// React to unit release...
}
}
Acuit Pinpoint Workstation exports services for the following interfaces:
- IServerFileRetriever
- IErrorHandler
- IHealthCheckPublisher - Acuit Pinpoint Workstation exports its own implementation for showing health check problems to the operator, but plug-ins can export their own additional implementation to be notified of health check problems.
- IHealthCheckService
- IDeviceRegistry - The following device types are registered by Acuit Pinpoint Workstation:
- IReadingsRegistry
- ILocalResourceCache
- IResourceProvider
- IResourceProviderRegistry
- IApplicationDispatcher
- IUserInterfaceService
- ITestParameterValueProviderRegistry
- IWorkflowEventManager
- IParameterValueProviderRegistry
- ITestingCoordinator
- IOptionsRegistry
- IActivatorService
- IAlarmsManager
- IBarCodeScannersService
- IItemScanningService
- IMenuRegistry
- ITablesProvider
- ITouchUserInterfaceService
- IUnitAtStationService
- IUnitProductionQueue
- IWorkstationService
- IWorkstationStatusManager
- IFileViewer - Acuit Pinpoint Workstation exports multiple implementations for all built-in reference content file viewers, but plug-ins can export their own to provide additional viewers.
- Microsoft.Extensions.Logging.ILoggerFactory
- Microsoft.Extensions.Logging.ILogger<TCategoryName>
- IServiceProvider
Prism exports its own services, including for the following interface (see the Prism documentation for other services):
- IRegionViewRegistry, used to register views to appear within UI regions.
User Interface Regions
Plug-ins can seamlessly integrate with the Acuit Pinpoint Workstation user interface by creating views and registering them to appear in certain user interface regions.
For example, the following plug-in module registers a WPF user control of type TestView
to appear
in the "manned unit plug-in region" of the Acuit Pinpoint Workstation user interface:
[ModuleExport("ExamplePlugIn", typeof(PlugInModule))]
public class PlugInModule : IModule
{
readonly IRegionViewRegistry _RegionViewRegistry;
[ImportingConstructor]
public PlugInModule(IRegionViewRegistry regionViewRegistry)
{
_RegionViewRegistry = regionViewRegistry;
}
public void Initialize()
{
_RegionViewRegistry.RegisterViewWithRegion(RegionNames.MannedUnitPlugInRegion, typeof(TestView));
}
}
See RegionNames for a description of the various regions that are available for use by plug-ins.