Besides the batch Sequential code workflow, there are the Navigator workflows: they are interactive code workflows that show visual controls to the user and wait for input.
The Navigator code workflows are supported only in GN4 version 2.0 or greater.
The structure of the interactive code workflows is the same than the batch workflows, but the tag name changes from <Sequential> to <Navigator>, this way:
<codeWorkflow
xmlns="http://www.teradp.com/schemas/GN4/1/WFRes.xsd">
<References />
<Imports />
<Members>
<![CDATA[
]]>
</Members>
<Navigator>
<![CDATA[
. . .
]]>
</Navigator>
</codeWorkflow>
The <Navigator> tag tells GN4 to run the workflow inside a form.
A Navigator workflow uses interactive activities (called interactions). Here is the list of the main interactions:
•Upload: allows user to import external files into GN4 system
•EditNewObject: allows user to edit or create a GN4 object
•EditObjects: allows user to edit multiple GN4 objects at time
•Publish: ask user where publishing a GN4 object and publishes it
•SearchForm: searches for GN4 object into GN4 database
•Crop: shows the cropping control
•Multicrop: allows user to crop multiple pictures at time
•Preview: shows the HTML preview of GN4 objects
Here is a sample of the syntax to call the interactive Upload activity into a Navigator workflow:
Dim uploadAct As Upload = New Upload(Context) With {.Name = "upload files"}
uploadAct.MinFileCount = 1
Dim uploadRes As UploadResult = Await uploadAct.Do()
Dim filePath As String = uploadRes.Data(0).LocalPath
The syntax to call an interactive activity is similar to the sequential one. In fact, just like the sequential activities, we have to:
1)Create a new activity object
An interaction is created like a sequential activity, there is no difference. We have to pass the ‘Context’ object to the activity and set the activity name. For example:
Dim uploadAct As Upload = New Upload(Context) With {.Name = "upload files"}
2)Set the input data
The interaction’s properties are set like the sequential ones, there is no difference.
Every activity has its own input properties. For example:
uploadAct.MinFileCount = 1
3)Execute the activity
To execute an interaction we have to call the Do() method (just like the sequential activities), but there is an important difference: the Await token.
The syntax to call an interaction inside a Navigator workflow is, for example:
Dim uploadRes As UploadResult = Await uploadAct.Do()
The Await token suspends the workflow until the user clicks on the Next button. It is available only from .NET Framework 4.5; this is because the Navigator workflows cannot work in GN4 1.6, which uses .NET Framework 4.0.
Note that, just like the sequential activities, every type of interaction has its corresponding result class. In this example, the Upload interaction saves the operation results into the UploadResult object.
4)Read the operation results
Into the Navigator workflows the output results of the activities are available as properties of the result objects (UploadResult, EditNewObjectResult, SearchFormResult, etc…), just like the sequential activities. For example:
Dim filePath As String = uploadRes.Data(0).LocalPath