yiannisf
yiannisf

Reputation: 11

Dynamically change the dialogs sequence with WiX Toolset

The installer that I am building in WiX does not have a fixed flow of dialogs. It is based on user input. For example I have a RadioButton to allow the user to configure the database or skip it for now. Based on the selection the next dialog should be different. What is the best approach to go about this?

I have tried using a property, that I had previously set, in the value field of the NewDialog event, like so:

<Publish Event="NewDialog" Value="[NEXTDIALOG]" Order="1">
  1
</Publish>

but, as I later found out this would not work as the Value field does not handle formatted text, only literal.

I then made a google search to find examples about showing a new dialog through a C# CustomAction, but couldn't find any. Maybe this is not even an option.

The only option that has been working so far is by using a condition like so:

<Publish Event="NewDialog" Value="Dialog1">
  [NEXTDIALOG] = "Dialog1"
</Publish>
<Publish Event="NewDialog" Value="Dialog2">
  [NEXTDIALOG] = "Dialog2"
</Publish>

but somehow this does not seem like the best practice. It seems to me that the need to change the sequence of the dialogs based on some user input, would be quite common, so I would expect a more native approach to it. Any suggestions?

Thanks in advance!

Upvotes: 1

Views: 930

Answers (1)

Going about changing the flow of the dialogs by setting a property and checking it on a Publish event IS a proper way to dynamically change the flow of dailogs.
However, you would have to guarantee that, if the user clicks on the Back button on your next dialog, it would have to jump back to the dialog at which the user made the initial choice.

As a developer, usually you would pick one of the existing dialog sets (WixUI_FeatureTree WixUI_InstallDir, WixUI_Minimal, WixUI_Advanced or WixUI_Mondo), change the flow to your own liking and use that one instead.

Take a look at this WIX page.

Upvotes: 1

Related Questions