Implement an Activity that Calculates a Logarithm
Implementing a custom activity allows you to build a reusable, completely custom behavior to augment the existing activities that come with Geocortex Workflow.
In this article, you will learn how to create a custom activity that calculates the logarithm of a number with a given base.
Prerequisites
important
Extending Geocortex Workflow for Mobile requires development and deployment of a custom Geocortex Mobile Application using the Geocortex Mobile SDK
Follow the instructions in the Geocortex Mobile SDK page to set up the environment for extending Workflow for Geocortex Mobile.
note
A working knowledge of C# and the .NET platform is recommended before extending Workflow for Geocortex Mobile
Set up the Activity Skeleton
- Create a new file
CalculateLog.cs
in the platform agnostic project of the Geocortex Mobile Quickstart. - Add a new skeleton workflow activity that implements
IActivityHandler
.
IActivityHandlerFactory
Register the Activity with the - Create a new file,
ActivityLoader.cs
in the platform agnostic project of the Geocortex Mobile Quickstart. - Implement the
IActivityHandlerFactory
interface and register the activity skeleton we created in the constructor.
note
Learn more about activity registration in the activity reference.
Implement the Custom Activity
We now have a empty activity that Geocortex Mobile can use that takes no inputs and produces no outputs. By changing the inputs, outputs, and execute logic, you can create your own custom activity that calculates the logarithm of a number.
First, let's change the execute logic to parse inputs that make sense for a logarithm activity.
Next, modify the Execute
method of the activity to calculate the logarithm of a number given an optional base
Test your Activity
Now you can build a workflow for Geocortex Mobile that uses your new activity!
tip
If you want your custom activity to show up with a friendly user interface in Geocortex Workflow Designer, check out Registering .NET Activities with Geocortex Workflow Designer.
The RunActivity
activity can be used to execute your activity by the name defined in CalculateLog.cs
(for this example, your:unique:namespace::CalculateLog
).
note
You can download this demo workflow that runs the custom activity and import it into the Geocortex Workflow Designer.
Next you need to run the workflow you just created in your Geocortex Mobile SDK project.
You can do this by configuring the layout and app config to run a workflow. You will need to copy the ID of the the workflow you created into the app.json
- App Config
- Layout
- UI
Relevant SDK Sample
Check out the relevant Geocortex Mobile SDK Sample:
Next Steps
Now you know how to build a basic Workflow activity for Geocortex Mobile. Next, you can learn how to access app properties in an activity, build custom form elements, use the ArcGIS Runtime SDK for .NET in your activities and more.
Implement a Custom Form Element
Implement a custom form element for applications like Geocortex Mobile
Add a Callout to the Map through a Custom Activity
Access the map in custom activities for Geocortex Mobile
Use the ArcGIS Runtime SDK for .NET in an activity.
Use the ArcGIS Runtime SDK for .NET in an activity or form element
Reference other Third Party Libraries
Reference other third party libraries in your activities and form elements