2014-12-05 91 views
0

我有如下一個定製GUI:Wix-有條件的GUI對話框用於維克斯安裝

<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> 

我試圖讓DemoDatabaseDlg對話框條件,所以如果是第一次用戶安裝那麼安裝程序將顯示「DemoDatabaseDlg」如果不跳過此對話框並跳轉到下一個。 我在考慮通過檢查安裝程序版本來制定這個條件,所以如果它是版本1.0及以上(版本> 1.0),那麼跳過對話框。 你認爲這是一個可行的想法嗎?任何提示或建議都非常受歡迎。

回答

1

Wix Control element可以有子元素Condition和Publish。用它們來創建你的邏輯。您也可以定義單獨的Publish元素以有條件地觸發事件,就像在您的示例中一樣。

您的回答是在Publish -element Control,EventValue屬性。