Reputation: 1839
I am working on an installer where I have to add a dialog for the user to make some application configuration choices. The dialog is shown before the installment procedure and the the configuration choices can only be applied after the installment when the required file are installed. The required file is some kind of configuration file which must be adapted based on the chosen configuration.
The sequence is as follows:
The configuration dialog will have 2 components: one checkbox and one dropdownlist. Currently I am struggling with the checkbox and reading it's value in a deferred Custom Action. This Custom Action is executed after the installation is finished.
So far, this is the code I have:
<Dialog Id="TempDlgId" ...>
<Control Id="MyCheckBoxId" Type="CheckBox" ... CheckBoxValue="0" Property="MyCheckBoxValue" Text="Sampe Text"/>
</Dialog>
This is the dialog for the user to choose the configuration.
<Custom Action="MyCustomAction.SetProperties" After="InstallFiles">NOT Installed</Custom>
<Custom Action="MyCustomAction" After="MyCustomAction.SetProperties">NOT Installed</Custom>
I applied the sequencing for my custom actions.
<CustomAction Id="MyCustomAction.SetProperties"
Return="check"
Execute="immediate"
Property="MyCustomAction"
Value="InstallLocation=[DEFAULTWORKINGDIRECTORY];MyCheckBoxValue=[MyCheckBoxValue]"/>
<CustomAction Id="MyCustomAction"
Return="check"
Execute="deferred"
BinaryKey="MyCustomAction.CA.dll"
Impersonate="yes"
DllEntry="MyCustomAction"
HideTarget="no"/>
Here is my definition of the custom actions.
[STAThread]
[CustomAction]
public static ActionResult MyCustomAction(Session session)
{
Debugger.Launch();
var installLocation = session.CustomActionData["InstallLocation"];
var hasModule = session.CustomActionData["MyCheckBoxValue"];
return ActionResult.Success;
}
This code has to change the configuration of the installed application and currently I am struggling with getting the checkbox value. It doesn't matter if the checkbox is checked or not, MyCheckBoxValue
is always empty. Is it possible to get the value of a checkbox in a deferred action? If it is possible, what do I have to do to get the checkbox value?
Upvotes: 0
Views: 238
Reputation: 1839
Since I am new to working on installers, I was not familiar with the fact that upper case actually has a functionality for creating installers with WiX. As soon as I wrote MyCheckBoxValue
completely in uppercases, it became a public property and I managed to get it's value in the deferred Custom Action.
Upvotes: 0