简体   繁体   中英

Wix- Conditional GUI Dialog for Wix installer

I have a customize GUI as below:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <UI Id="myUi">
      <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
      <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
      <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
      <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
      <Property Id="WixUI_Mode" Value="Minimal" />
      <DialogRef Id="ErrorDlg" />
      <DialogRef Id="FatalError" />
      <DialogRef Id="FilesInUse" />
      <DialogRef Id="MsiRMFilesInUse" />
      <DialogRef Id="PrepareDlg" />
      <DialogRef Id="ProgressDlg" />
      <DialogRef Id="ResumeDlg" />
      <DialogRef Id="UserExit" />

      <!-- This is the welcome dialog you specified-->
      <DialogRef Id="WelcomeDlg" />
      <!-- Hook the new welcome dialog to the next one in the stack-->
      <Dialog Id="DemoDatabaseDlg"  Width="370" Height="270" Title="Configutation settings" NoMinimize="yes">

        <Control Id="QueryServiceLabel" Type="Text" X="45" Y="73" Width="220" Height="15" TabSkip="no" Text="QueryService Value" />
        <Control Id="QueryServiceNameEdit" Type="Edit" X="45" Y="85" Width="220" Height="18" Property="QUERYSERVICEVALUE" Text="{80}" />
        <Control Id="IFinderLabel" Type="Text" X="45" Y="105" Width="100" Height="15" TabSkip="no" Text="&amp;IFinder Value" />
        <Control Id="IFinderEdit" Type="Edit" X="45" Y="117" Width="220" Height="18" Property="IFINDERVALUE" Text="{80}" />
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back"></Control>
     <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next"></Control>
        <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>

      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="DemoDatabaseDlg">1</Publish>
    <Publish Dialog="DemoDatabaseDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg"><![CDATA[Version < "0.8.0.0"]]></Publish>
    <Publish Dialog="DemoDatabaseDlg" Control="Next" Event="NewDialog" Value="PrepareDlg">1</Publish> -->
      <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>


      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
      <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>

      <Property Id="ARPNOMODIFY" Value="1" />
    </UI>

    <UIRef Id="WixUI_Common" />
  </Fragment>
</Wix>

I am trying to make DemoDatabaseDlg Dialog conditional , so if it is the first time the user is installing the installer then " DemoDatabaseDlg " should be display if not Skip this dialog and jump to the next one. I was thinking to make this condition by checking the installer version , so if it is the version 1.0 and above (Version > 1.0) then skip the Dialog. Do you think this is a doable idea? any hints or suggestions are very welcome.

Wix Control element can have child elements Condition and Publish. Use them to create your logic. You can also define separate Publish elements to trigger events conditionally, just like in your example.

Your answer is in the Publish -element Control , Event and Value attributes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM