The buttons of a Navigator workflow

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 19:01

The ‘Next’ and ‘Cancel’ buttons

When an interaction is executed, it shows the visual controls to the user and waits for input. At the bottom of the form are displayed the ‘Next’ and ‘Cancel’ buttons, like the old WindowsWorkflow; so the user can choose if going to the next activity (Next) or aborting the execution of the workflow (Cancel).

The ‘Finish’ button

Because the code workflows are not managed by the .NET WindowsWorkflowFoundation engine, GN4 doesn’t know if the current interaction is the last one or not. So, to show the ‘Finish’ button instead of the ‘Next’ button when the last activity is executed, you have to explicitly set the ShowFinishButton property of the last interactive activity of your workflow.

For example:

Dim uploadAct As Upload = New Upload(Context) With {.Name = "upload files", .ShowFinishButton = True}

Running this activity, the ‘Finish’ button is displayed, to indicate that it is the last interaction of the workflow. However, note that it is only a change of the button label: there isn’t any verification whether the activity is the actual last of the workflow or not.

The ‘Back’ button

The ‘Back’ is not visible in code workflows by default. This is because, in code workflows, it must be managed by the code workflow itself.

The ‘Back’ button is managed using the VB.NET line-label and GoTo statements.

Here is an example of the syntax used to enable the ‘Back’ button into the code workflow:

'---------- first interaction

uploadAct:

Dim uploadAct As Upload = New Upload(Context) With {.Name = "upload"}

. . .

Dim uploadRes As UploadResult = Await uploadAct.Do()

 

'---------- last interaction interaction

editMetaDataAct:

Dim editMetaDataAct As EditNewObject = New EditNewObject(Context) With {.Name = "editMetaData", .ShowBackButton = True, .ShowFinishButton = True}

. . .

Dim editMetaDataRes As EditNewObjectResult = Await editMetaDataAct.Do()

If Context.GoBack Then GoTo uploadAct

To enable the ‘Back’ button in a code interaction:

1.Set the ShowBackButton property to true.

This will display the ‘Back’ button next to the ‘Cancel’ and ‘Next’ buttons. For example:

Dim editMetaDataAct As EditNewObject = New EditNewObject(Context) With {.Name = "editMetaData", .ShowBackButton = True, .ShowFinishButton = True}

2.Set a VB.NET line-label just before the activity target of the ‘Back’ button.

In the example, we want that the ‘Back’ button of the EditNewObject activity returns to the previous Upload activity. So, we write the ‘uploadAct:’ line-label just before the creation of the target Upload activity.

uploadAct:

Dim uploadAct As Upload = New Upload(Context) With {.Name = "upload"}

3.Check the Context.GoBack property just after the activity which shows the ‘Back’ button.

When the user clicks on the ‘Back’ button, the Context.GoBack property is set to true. So, we can check this property to determine if retuning to the previous activity or not. For example:

Dim editMetaDataRes As EditNewObjectResult = Await editMetaDataAct.Do()

If Context.GoBack Then GoTo uploadAct