Skip to content

Tour Navigation

JanDotNet edited this page May 20, 2017 · 3 revisions

The FeatureTour class provides a method to get an instance of IFeatureTourNavigator.

IFeatureTourNavigator navigator = FeatureTour.CreateNavigator();

That IFeatureTourNavigator enables the developer to control the tour progress during application logic and to control the application during tour interactions.

Navigate programmatically

Usage

var navigator = FeatureTour.CreateNavigator();
navigator.IfCurrentStepEquals("StepID").GoNext();
navigator.IfCurrentStepEquals("StepID").GoPrevious();
navigator.IfCurrentStepEquals("StepID").Close();

Use Case

Imagine the user runs an active tour and arrives the step "CreateItem". The popup requests the user to create a new item and the next button is not shown. The logic, that creates a new item, can be simply extended by the following code:

if (itemWasCreatedSuccessfully)
{
    var navigator = FeatureTour.CreateNavigator();
    navigator.IfCurrentStepEquals("CreateItem").GoNext();
}

That makes it really easy to create interactive tours.

Attach doable action

Allows the developer to attach actions to a specific step. That automatically makes the "Do It!" button on the popup visible. If the user hits the "Do It!" button, the attached action will be executed.

Usage

var navigator = FeatureTour.CreateNavigator();

// DoAction only
navigator.ForStep("StepID").AttachDoable(
            currentStep => { /* DoAction - will be executed when the 'Do it!'-button was pressed */ });

// DoAction + CanDoAction (for disabling DO-button if needed)
navigator.ForStep("StepID").AttachDoable(
            currentStep => { /* DoAction - will be executed when the 'Do it!'-button was pressed */ }, 
            currentStep => { /* CanDoAction */ return true; });

Use Case

Imagine, the user runs a tutorial and arrieves step "FillComplexForm". That step requires that the user enter complex information (e.g. a specific path). Adding attachable doables enables the developer to execute that kind of task programatically:

var navigator = FeatureTour.CreateNavigator();
navigator.ForStep("FillComplexForm").AttachDoable(currentStep => textBox.Text = "C:\\User...");

That helps to create even complex tutorials without annoying the user with tasks that are required for the tutorial but provide no learning effect to the user.

React on step changes

Usage

var navigator = FeatureTour.CreateNavigator();
navigator.OnStepEntered("StepID").Execute(enteredStep => { /* ActionToExecute */ });
navigator.OnStepEntering("StepID").Execute(enteringStep => { /* ActionToExecute */ });
navigator.OnStepLeft("StepID").Execute(leavedStep => { /* ActionToExecute */ });
navigator.OnClosed().Execute(currentStep => { /* ActionToExecute */ });

UseCase Imagine, the user runs a tutorial and the next step ("SpecialTabItemStep") is attached to an UIElement on a specific tab. Therefore it is required that the tab is selected before the tour reachs that step (otherwise the popup is not shown).

The following code ensures, that the correct tab is selected before the step is entered:

var navigator = FeatureTour.CreateNavigator();
FeatureTourNavigator.OnStepEntering("SpecialTabItemStep").Execute(enteringStep => { tabControl.SelectedIndex = 2; });

That enables the developer to prepare the application (if required) so that the UIElement for the next step is available.