Hello,
When using custom themes, in case the package has any launch condition defined and the launch condition gets fired during installation, the dialog does not have the UI of the theme, which may not look nice.
In this case, you need to substitute the funcionality using custom dialogs.
Let's consider the following test case: Prevent installation on machines that have less that 32GB of RAM.
If we were using the default MSI theme, the launch condition would be something as this:
However, if using a custom theme e.g. Vivid, the dialog will not inherit the same layout, and it would look something as below:
The dialog cannot be further customized.
To overcome this, you can disable the launch condition from the Launch Conditions view. The good news is that Advanced Installer can detected and fill a property with the detected RAM from the target machine if the property is used in a condition field. For the case of detected installed RAM, the property is AI_DETECTED_PHYSICAL_MEMORY.
When enabling a launch condition a search operation is performed by Advanced Installer. The good news, is that you can also force the search if just using any of those properties in a Condition field, e.g. in the Condition field to condition a custom action execution, the condition field of a component or feature etc.
In our case, we will display a dialog and condition the dialog appeareance based on the value of AI_DETECTED_PHYSICAL_MEMORY.
Let's swtich to Surface theme.
We will display a dialog informing the user that the installation cannot proceed on machines that have less than 32 GB of RAM.
For this, please follow the below steps:
1) Select the Next from the InstallDlg
2) Go to the Published Events tab and add a new event
3) Select the Display a specific child dialog event with the below options:
Notice the added condition in the Condition field.
After this step, you need to make sure that the newly aded event is the the last in the list, at the bottom in the event list for the Next control.
This is required as the events of diaplying dialogs are executed bottom up and only the first that has the condition true is executed.
4) The newly added dialog should be liek below:
Design the dialog per your scenario. In our case, we will name the dialog LCDialog. Also, a single OK button will be added. The dialog won't allow the user to move forward with the installation, but it won't close the installation. e.g. if the argument will be different e.g. Exit the installer will move to FatalDlg while having the default Return argument will keep displaying the InstallDlg.
When the launch condition gets fired the user will be prompted with the below dialog:
As you can see, the launch condition has the same layout, and most of all you have full access to customize it, whatever you like.
Now, we handled the case when the installation is done through the UI. It's time to prevent the installation if the user is trying to install the app silently, or passing the /qb flag to avoid displaying dialogs.
To prevent the installation when a condition is true, you can just add the Display an error message predefined custom action. Use the same Condition: AI_DETECTED_PHYSICAL_MEMORY < 32768
Please note that the setup will set the AI_DETECTED_PHYSICAL_MEMORY property with the RAM in MB.
Here's how the custom action should be customized:
So, this is one approach to display a custom dialog based on a condition. In our case, we've been using the predefined AI_DETECTED_PHYSICAL_MEMORY property. If you are using other launch condition but you don't know for sure what is the property that is used by the setup, you can check the Launch Conditions table.
The sample project is attached to this thread, so if you are interested to take a look directly at my project, you are more than welcome to download the project file.
Let us know for similar scenarios!