0

I am writing an Installer in Wix and want the following sequence where the order of dialogs and custom actions are mixed. There are two scenarios.

First scenario: the user installs the software for trial:

  1. Welcome (dialog)
  2. License agreement (dialog)
  3. Register installation on my website (custom action), the web server responds new user (trial period).
  4. --
  5. --
  6. Finish installation (dialog)

Second scenario: the user has already used the software for the trial period and must type a license code for full installation. New steps are marked with an *.

  1. Welcome (dialog)
  2. License agreement (dialog)
  3. Register installation on my website (custom action), * the web server responds old user (license needed).
  4. *Type License key (dialog)
  5. *Verify License Key at web server (custom action).
  6. Finish installation (dialog)

The two scenarios differ in how the web server responds in step 3. It's important that step 3 comes after acceptance of license terms.

I have no problem running the dialogs, and I can run the custom actions. But I can't figure out how to mix the sequence of them. I have been using Nick Ramirez WIX Cookbook, but I can't see that it covers the topic.

Question 1: How do I mix the sequence of dialogs and custom action?

Question 2: How can the result of a Custom action (step 3) be used to chose between two different dialogs (step 4 or 6)?

Anders Finn Jørgensen
  • 1,275
  • 1
  • 17
  • 33
  • [Maybe have a quick read here](https://stackoverflow.com/a/24360658/129130) for some thoughts on the issue of licensing in setups. – Stein Åsmul Apr 26 '19 at 20:31
  • 1
    And [here is another answer on WiX dialogs](https://stackoverflow.com/a/52674815/129130). As well as [the WiX documentation for dialog sequence customization (and more)](http://wixtoolset.org/documentation/manual/v3/wixui/wixui_customizations.html#changing-the-ui-sequence-of-a-built-in-dialog-set). [Main documenation index](http://wixtoolset.org/documentation/manual/v3/). – Stein Åsmul Apr 26 '19 at 22:05
  • 1
    [Neil Sleightholm, customizing WiX UI](http://neilsleightholm.blogspot.com/2008/08/customised-uis-for-wix.html). [WiX customized GUI github sample](https://github.com/skullpsg/Wix_installer/tree/master/BlogCustomAction/BlogCustomAction) (untested by me, but a real-world sample nonetheless). Sorry for the messy formatting. I found some links after my first comment. – Stein Åsmul Apr 26 '19 at 22:48

1 Answers1

0

After some trial and error I found this solution to the problem:

<Property Id="INSTALL_WEB_RESPONSE" Value="NO" />
<UI Id="UIFlow">
   <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="DoAction" Value="CA_Licens">LicenseAccepted = "1"AND INSTALL_WEB_RESPONSE = "NO"</Publish>
   <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="MyCustomDlg">LicenseAccepted = "1" AND INSTALL_WEB_RESPONSE = "OVERSKREDET"</Publish>
   <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">LicenseAccepted = "1" AND INSTALL_WEB_RESPONSE = "GEMT"</Publish>
</UI>

After you have accepted the license agreement (Control="Next") there are three options.

First you want to run a custom action "CS_Licens", this action change the INSTALL_WEB_RESPONSE property. Depending on the change the INSTALL_WEB_RESPONSE property, the installer somehow jumps back to the License agreement dialog and chose a new next event:

Event="NewDialog" Value="MyCustomDlg"

or

Event="NewDialog" Value="VerifyReadyDlg"

In other words: The value of the property INSTALL_WEB_RESPONSE controls the flow and the custom action is not (directly) involved in the flow at all.

Anders Finn Jørgensen
  • 1,275
  • 1
  • 17
  • 33