Workflow Activity Reference
In the Geocortex Workflow .NET SDK, activities are represented as simple classes with an Execute
method.
tip
Use a unique prefix on the Action
property to avoid it conflicting with someone else's custom activities.
Registering Activities
Every Geocortex Mobile application that implements custom workflow activities needs to implement an IActivityHandlerFactory
. The IActivityHandlerFactory
is responsible for registering the custom activities with Geocortex Mobile so they can be created by Geocortex Workflow at runtime.
The ActivityLoader
registers custom activities in its constructor. Only one instance of the loader is required per Geocortex Mobile Application, as it can register multiple activities.
info
Two key components of this snippet are the [assembly: Export(...)]
tag and the class extension ActivityLoader : IActivityHandlerFactory
. These two pieces register the ActivityLoader
with Geocortex Mobile and cause it to be initialized on startup.
Access Geocortex Mobile Functionality
You can access Geocortex Mobile functionality in custom workflow activities by using the built-in dependency injection pattern to inject shared Geocortex Mobile services such as the UIOperations
service.
First, add the class you want to inject to the constructor of the custom activity.
Next, inject the activity into the IActivityHandlerFactory
for the application.
note
Since the DisplayGeocortexMobileAlert
activity is injected into the IActivityHandlerFactory
with Autofac, it's dependency on the UIOperations
class will be be resolved by Autofac.
Finally, you can implement your activity using the referenced Geocortex Mobile class.
- Custom Activity
- IActivityHandlerFactory
Access the Application Map
The map of the host application can be accessed through dependency injection . The MapProviderBase
class which exposes the Map and MapView can be injected with the ProviderFactoryAttribute
.
note
For a complete example, check out the Show Callout on Map custom activity tutorial.