2014-01-22 30 views
3

具有以下維克斯引導程序的主題:維克斯引導程序自定義失敗頁面信息依賴於錯誤代碼

<?xml version="1.0" encoding="utf-8"?> 
<Theme xmlns="http://wixtoolset.org/schemas/thmutil/2010"> 
    <Window Width="485" Height="300" HexStyle="100a0000" FontId="0">#(loc.Caption)</Window> 
    <Font Id="0" Height="-12" Weight="500" Foreground="000000" Background="FFFFFF">Segoe UI</Font> 
    <Font Id="1" Height="-24" Weight="500" Foreground="000000">Segoe UI</Font> 
    <Font Id="2" Height="-22" Weight="500" Foreground="666666">Segoe UI</Font> 
    <Font Id="3" Height="-12" Weight="500" Foreground="000000" Background="FFFFFF">Segoe UI</Font> 
    <Font Id="4" Height="-12" Weight="500" Foreground="ff0000" Background="FFFFFF" Underline="yes">Segoe UI</Font> 

    <Image X="11" Y="11" Width="64" Height="64" ImageFile="logo.png" Visible="yes"/> 
    <Text X="80" Y="11" Width="-11" Height="64" FontId="1" Visible="yes">#(loc.Title)</Text> 

    <Page Name="Install"> 
     <Richedit Name="EulaRichedit" X="11" Y="80" Width="-11" Height="-70" TabStop="yes" FontId="0" HexStyle="0x800000" /> 
     <Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="246" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox> 
     <Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button> 
     <Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button> 
     <Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCloseButton)</Button> 
    </Page> 

    <Page Name="Options"> 
     <Text X="11" Y="80" Width="-11" Height="30" FontId="2">#(loc.OptionsHeader)</Text> 
     <Text X="11" Y="121" Width="-11" Height="17" FontId="3">#(loc.OptionsLocationLabel)</Text> 
     <Editbox Name="FolderEditbox" X="11" Y="143" Width="-91" Height="21" TabStop="yes" FontId="3" FileSystemAutoComplete="yes" /> 
     <Button Name="BrowseButton" X="-11" Y="142" Width="75" Height="23" TabStop="yes" FontId="3">#(loc.OptionsBrowseButton)</Button> 
     <Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsOkButton)</Button> 
     <Button Name="OptionsCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsCancelButton)</Button> 
    </Page> 

    <Page Name="Progress"> 
     <Text X="11" Y="80" Width="-11" Height="30" FontId="2">#(loc.ProgressHeader)</Text> 
     <Text X="11" Y="121" Width="70" Height="17" FontId="3">#(loc.ProgressLabel)</Text> 
     <Text Name="OverallProgressPackageText" X="85" Y="121" Width="-11" Height="17" FontId="3">#(loc.OverallProgressPackageText)</Text> 
     <Progressbar Name="OverallCalculatedProgressbar" X="11" Y="143" Width="-11" Height="15" /> 
     <Button Name="ProgressCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ProgressCancelButton)</Button> 
    </Page> 

    <Page Name="Modify"> 
     <Text X="11" Y="80" Width="-11" Height="30" FontId="2">#(loc.ModifyHeader)</Text> 
     <Button Name="RepairButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.ModifyRepairButton)</Button> 
     <Button Name="UninstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ModifyUninstallButton)</Button> 
     <Button Name="ModifyCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ModifyCloseButton)</Button> 
    </Page> 

    <Page Name="Success"> 
     <Text X="11" Y="80" Width="-11" Height="30" FontId="2">#(loc.SuccessHeader)</Text> 
     <Button Name="LaunchButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.SuccessLaunchButton)</Button> 
     <Text Name="SuccessRestartText" X="-11" Y="-51" Width="400" Height="34" FontId="3" HideWhenDisabled="yes">#(loc.SuccessRestartText)</Text> 
     <Button Name="SuccessRestartButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.SuccessRestartButton)</Button> 
     <Button Name="SuccessCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.SuccessCloseButton)</Button> 
    </Page> 

    <Page Name="Failure"> 
     <Text X="11" Y="80" Width="-11" Height="30" FontId="2">#(loc.FailureHeader)</Text> 
     <Hypertext Name="FailureLogFileLink" X="11" Y="121" Width="-11" Height="42" FontId="3" TabStop="yes" HideWhenDisabled="yes">#(loc.FailureHyperlinkLogText)</Hypertext> 
     <Hypertext Name="FailureMessageText" X="22" Y="163" Width="-11" Height="51" FontId="3" TabStop="yes" HideWhenDisabled="yes" /> 
     <Text Name="FailureRestartText" X="-11" Y="-51" Width="400" Height="34" FontId="3" HideWhenDisabled="yes">#(loc.FailureRestartText)</Text> 
     <Button Name="FailureRestartButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.FailureRestartButton)</Button> 
     <Button Name="FailureCloseButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.FailureCloseButton)</Button> 
    </Page> 
</Theme> 

什麼我需要做的,有一個自定義錯誤消息,當用戶點擊取消?

基本上,我需要一個條件,FailureMessageText是評估的情況下「0x80070642 - 用戶已取消安裝」

失敗窗口應該就會顯示「安裝被用戶取消」,而不是「安裝失敗」

是有沒有什麼方法可以根據一定的條件來評估主題和顯示控件中的上述表達式?

* 編輯 - 2014年1月30日*

這裏的問題是元素:

<Page Name="Failure"> 
... 
    <Hypertext Name="FailureMessageText" X="22" Y="163" Width="-11" Height="51" FontId="3" TabStop="yes" HideWhenDisabled="yes" /> 
... 
</Page> 

我可以這樣寫:

<Page Name="Failure"> 
... 
    <Text Name="MyCustomText" X="-11" Y="-51" Width="400" Height="34" FontId="3" HideWhenDisabled="yes"> My custom message </Text> 
... 
</Page> 

但這不會檢查是否錯誤代碼是0x80070642(用戶取消安裝),它只是另一個硬編碼的消息。

回答

0

要顯示自定義錯誤消息,您需要更改由LocalizationFile屬性指向的WixBootstrapperTheme.wxl文件中的消息。

<Bundle ...> 
................. 
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"> 
     <bal:WixStandardBootstrapperApplication 
     LicenseUrl="" 
     LogoFile="Logo.png" 
     SuppressOptionsUI="yes" 
     LocalizationFile="BootstrapTheme.wxl" 
     ThemeFile="BootstrapTheme.xml"/> 
    </BootstrapperApplicationRef> 
................ 
</Bundle> 
+0

但我想要基於錯誤代碼的自定義錯誤。 如果用戶取消安裝,則顯示消息「用戶已取消安裝該軟件包」。 如果發生其他任何情況,請使用正確的錯誤代碼顯示默認的「安裝失敗」頁面。 此外,請給出一個代碼示例 –

+0

此鏈接可能會幫助你。(https://github.com/adblockplus/adblockplusie/tree/master/installer) – 123r789

+0

它實際上對我沒有任何幫助。 文件bootstrap-theme.xml(https://github.com/adblockplus/adblockplusie/blob/master/installer/bootstrap-theme.xml)幾乎和我的一樣。 這是問題元素: ... ... 我可以這樣寫: <頁面名稱= 「失敗」> ... <文本名稱= 「定製」 X =「 - 11」Y =「 - 51」Width =「400」Height =「34」FontId =「3」HideWhenDisabled =「yes」>我的自定義信息 ... - 但這不會檢查如果錯誤代碼是0x80070642。 –

相關問題