Wix installer refresh page after custom action - wix

I am looking for way to refresh current page after custom action.
My code
<Control Id="Config" Type="PushButton" .../>
<Publish Event="DoAction" Value="SetConfiguration"></Publish>
</Control>
It can be after custom action, but I don't see that Session has such an opportunity, or just adding some Event to Control that will work.
Edit:
Ok I have somethink like this:
<Control Id="Config" Type="PushButton" X="120" Y="243" Width="56" Height="17" Default="yes" Text="Config" >
<Publish Event="DoAction" Value="SetConfiguration" Order="1"></Publish>
<Condition Action="disable">EndConfig = "true"</Condition>
<Condition Action="enable">EndConfig = "false"</Condition>
<Publish Event="NewDialog" Value="IISconfiguration2">EndConfig="true</Publish>
</Control>
But how to create NewDialog after return result custom acion. Because it now do it in this same time. Set order on 1 and 2 dont work.

Try this
<Control Id="Config" Type="PushButton" X="120" Y="243" Width="56" Height="17" Default="yes" Text="Config" >
<Publish Event="DoAction" Value="SetConfiguration">1</Publish>
<Condition Action="disable">EndConfig = "true"</Condition>
<Condition Action="enable">EndConfig = "false"</Condition>
<Publish Event="NewDialog" Value="IISconfiguration2">2</Publish>
</Control>

This is a known behavior in MSI native UI.
The best work around I have is to make a clone of the dialog and transition from the original to the clone dialog (or the clone to the original) so that it looks like the same dialog to the user but it's actually a different dialog and the data will be refreshed.
Example.
On SQLDlg1:
<Control Id="Test" Type="PushButton" Text="&Test" TabSkip="no" Default="yes" Height="17" Width="56" X="283" Y="195">
<Publish Event="NewDialog" Value="SQLDlg2">1</Publish>
<Publish Event="DoAction" Value="ValidateDatabase">1</Publish>
</Control>
On SQLDlg2:
<Control Id="Test" Type="PushButton" Text="&Test" TabSkip="no" Default="yes" Height="17" Width="56" X="283" Y="195">
<Publish Event="NewDialog" Value="SQLDlg1">1</Publish>
<Publish Event="DoAction" Value="ValidateDatabase">1</Publish>
</Control>
On the next dialog I also clear the property in case they click back.
<Publish Dialog="VerifyReadyDlg" Control="Back" Property="DatabaseValid" Value="{}">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SQLDlg">1</Publish>

Related

Wix Custom Action Property Not Immediately Available

I have a Wix VBScript Custom Action that sets a Property, and then a publish event that is supposed to trigger based on the value of the set property. The issue seems to be that the property is not being set and in turn not triggering the next publish event. Has anyone successfully done something similar?
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:hsi="http://schemas.hyland.com/wix/UtilityExtension">
<Fragment>
<Property Id="FOO" Value="0" Secure="yes" />
<CustomAction Id="Test3" Script="vbscript">
<![CDATA[
MsgBox Session.Property("FOO")
]]>
</CustomAction>
<CustomAction Id="Test2" Script="vbscript">
<![CDATA[
MsgBox "Test"
]]>
</CustomAction>
<CustomAction Id="Test1" Script="vbscript">
<![CDATA[
Session.Property("FOO") = "1"
]]>
</CustomAction>
</Fragment>
<Fragment>
<UI>
<DialogRef Id="WarningModalDlg"/>
<Dialog Id="BaseLawsonWebServerDlg" Width="370" Height="270" Title="Lawson LOB Broker Relay Setup">
<Control Id="label" Type="Text" X="20" Y="50" Width="200" Height="16" Text="Test" TabSkip="yes" Transparent="yes" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
<Publish Order="1" Event="DoAction" Value="Test3">1</Publish>
<Publish Order="2" Event="DoAction" Value="Test2">FOO = "1"</Publish>
<Publish Order="3" Event="DoAction" Value="Test1">1</Publish>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)"/>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
Event="DoAction" Value="Test1" fires, I've tested it. Event="DoAction" Value="Test2">FOO = "1" does not hit. Then Event="DoAction" Value="Test3">1</Publish> definitely hits and shows the message box with the default value.
Thanks ahead of time!
I figured it out! I was so used to the reverse order of UI Dialog Publish events that I did the same thing for Control publish events.
Control Publish events move in the the order of 1 to x.
The publish events should look like this instead:
<Publish Order="1" Event="DoAction" Value="Test1">1</Publish>
<Publish Order="2" Event="DoAction" Value="Test2">FOO = "1"</Publish>
<Publish Order="3" Event="DoAction" Value="Test3">1</Publish>

Stop setup error inside Custom Action With WIX installer

Can i able to stop the setup if any error display inside CustomAction. As i can able display error message inside custom Action and it's dispaly the error message but as soon as i click on ok button my next UI sequence form is appearing.How i will force user to finish button?
Adding my source code:
<Binary Id="BIN_CustomAction" SourceFile="CustomAction.CA.dll" />
<CustomAction Id="CA_CheckList" BinaryKey="BIN_CustomAction" DllEntry="CA_CheckList" Execute="immediate" Impersonate="yes" Return="ignore" />
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
<DialogRef Id="UserRegistrationDlg" />
<Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="ComboBoxMain" Type="ComboBox" X="124" Y="158" Width="241" Height="16" Property="LOCATIONNAME">
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="SpawnDialog" Value="SetupTypeDlg">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
<Control Id="Next" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&NExt">
<Publish Event="DoAction" Value="RadioButtonCheck">1</Publish>
</Control>
</Dialog>-->
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="UserRegistrationDlg" Order="3">
LicenseAccepted = "1"
</Publish>
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="UserRegistrationDlg">1</Publish>
</UI>
<InstallUISequence>
<Custom Action="CA_CheckList" Before="AppSearch">Not Installed</Custom>
</InstallUISequence>
[CustomAction]
public static ActionResult CA_CheckList(Session session)
{
if (installer.ListStatus == false)
{
// dispaly
Record record = new Record();
record.FormatString = string.Format("Error!");
session.Message(
InstallMessage.Error | (InstallMessage)(MessageIcon.Error) |
(InstallMessage)MessageButtons.OK,record);
return ActionResult.Failure;
}
else
{
return ActionResult.Success;
}
}
Add screen shot also proving once i click on Ok button of image(1) my next dialog i.e image (2) is appearing:- instead of what i need is Finish dialog when i am getting the error.
1)
2)
Any idea??kindly help me.
This is an old post but I'd like to answer the question in case somebody else finds this. In the custom action definition, CustomAction Id="CA_CheckList" BinaryKey="BIN_CustomAction" ..., 'Return' is set to 'ignore'. It should be set to 'check'.
It's all about returning the correct "error code" from the custom action. If you want to terminate the installation, return ActionResult.Failure from your CA.
Side note: displaying UI from inside the custom action is generally a bad idea - this scenario doesn't support silent installation the way it should go.

WIX UI Property Change Not Publishing

I have a edit control in WIXUI that's bound to a property
<Property Id="WIXUI_FILESHAREDIR">FILESHAREDIR</Property>
and the UI
<Control Id="FileSharePathGroup" Type="GroupBox" Height="89" Width="352" X="8" Y="96" Text="File Share"/>
<Control Id="FileSharePathLabel" Type="Text" X="20" Y="114" Width="69" Height="13" Text="File Share Path"/>
<Control Id="FileSharePathEdit" Type="PathEdit" X="20" Y="126" Width="250" Height="16" Property="WIXUI_FILESHAREDIR" Indirect="yes" />
<Control Id="FileSharePathBrowse" Type="PushButton" X="280" Y="125" Width="56" Height="17" Text="Browse"/>
and the following Publish statements:
<Publish Dialog="ConfigurationDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Dialog="ConfigurationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="ConfigurationDlg" Control="FileSharePathBrowse" Property="_BrowseProperty" Value="[WIXUI_FILESHAREDIR]" Order="1">1</Publish>
<Publish Dialog="ConfigurationDlg" Control="FileSharePathBrowse" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
When I use the browse button the FILESHAREDIR property ends up getting updated correctly. When I type into the text editor manually and hit Next, it doesn't and the FILESHAREDIR retains the incorrect default value at install time.
Am I missing a Publish statement?
You need to use the Property#Secure attribute to list the public property in the SecureCustomProperties property.

Checking on the click of next button whether the user has entered a value in textbox

I want to know how do I validate the entry in the textbox? I am making use of the wix toolset 3.5. What I mean is I should get a prompt or some message that says that you must enter the text (I have a name of the person here ) and the installation must not proceed without it.
You need to modify your UI element so that there is a conditional Publish tag that determines if the property attached to the TextBox is populated or not:
<Publish Dialog="NameSettingsDlg"
Control="Next"
Property="ErrorMessage" Value="You need to fill in your name!"
Order="1">
NOT NAME_PROPERTY
</Publish>
<Publish Dialog="NameSettingsDlg"
Control="Next"
Event="SpawnDialog"
Value="InvalidSettingsDlg"
Order="2">
NOT NAME_PROPERTY
</Publish>
<Publish Dialog="NameSettingsDlg"
Control="Next"
Event="NewDialog"
Value="VerifyReadyDlg">
</Publish>
where the "InvalidSettingsDlg" is defined as:
<Fragment>
<UI>
<Dialog Id="InvalidSettingsDlg"
Width="260"
Height="85"
Title="!(loc.InvalidSettingsDlg_Title)">
<Control Id="OK" Type="PushButton" X="102" Y="57" Width="56"
Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIOK)">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="Text" Type="Text" X="48" Y="22" Width="194" Height="30"
Text="[ErrorMessage]" />
<Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24"
ToolTip="!(loc.InvalidSettingsDlgIconTooltip)" FixedSize="yes"
IconSize="32" Text="WixUI_Ico_Exclam" />
</Dialog>
</UI>
</Fragment>

How do you create a waiting dialog in WIX?

I'm trying to create a dialog to display whilst the installer is checking an SQL server exists. I've used the following code:
<Control Id="Next" Type="PushButton" X="244" Y="243" Width="56" Height="17" Text="!(loc.WixUINext)">
<!--Show Waiting dialog-->
<Publish Property="SQLServerChecked" Value="0">1</Publish>
<Publish Event="SpawnWaitDialog" Value="WaitCheckSQLServerDlg">
SQLServerChecked = "1"
</Publish>
<!--Checks the SQL server exists-->
<Publish Event="DoAction" Value="CheckSQLServerExists">1</Publish>
<Publish Property="SQLServerChecked" Value="1">1</Publish>
</Control>
However my WaitCheckSQLServerDlg shows, never disappears and the Action CheckSQLServerExists doesn't get run. How would I alter my code so that the WaitCheckSQLServerDlg displays whilst the CheckSQLServerExists action is running?
Thanks