Wix将自定义对话框插入内置对话框集中的问题

时间:2019-08-23 16:43:31

标签: wix

我创建了一个名为ApiKeyDlg的对话框,该对话框已嵌套在UI中。 UI是内置WixUI_InstallDir的直接副本,但有一些细微调整。

我添加了dialogref和publish元素,但是由于某些原因,ApiKeyDlg对话框未显示。 candle.exelight.exe都不会显示任何错误,并且MSI文件可以完美安装,只是不显示我的自定义对话框。

在Stackoverflow上有很多与此问题类似的问题,我已经阅读了其中的8或10个问题,并且还没有进一步回答我的问题的机会。我还阅读了本指南(https://wixtoolset.org/documentation/manual/v3/wixui/wixui_customizations.html),特别是有关“将自定义对话框插入到内置对话框集中”的最后一段,但是没有点击,而且我也没有进一步的了解。

(用于安装的)订单应为:

  1. 欢迎
  2. 许可证
  3. ApiKey
  4. 验证
  5. 退出(完成)
<UI Id="MyWixUI_InstallDir">
    <TextStyle Id="WixUI_Font_Normal" FaceName="Calibri" Size="8" />
    <TextStyle Id="WixUI_Font_Bigger" FaceName="Calibri" Size="12" />
    <TextStyle Id="WixUI_Font_Title" FaceName="Calibri" Size="9" Bold="yes" />

    <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
    <Property Id="WixUI_Mode" Value="InstallDir" />

    <Dialog Id="ApiKeyDlg" Width="370" Height="270" Title="Organisation ID required" Modeless="yes">
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUICancel)">
            <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
        <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="20" Transparent="yes" NoPrefix="yes" Text="Please enter the ID of the organisation to which this device belongs" />
        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="Organisation ID" />
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" TabSkip="yes" Text="!(loc.WixUIBack)" />
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" TabSkip="yes" Text="!(loc.WixUINext)" />
        <Control Id="ActionData" Type="Text" X="135" Y="125" Width="220" Height="30" Transparent="yes" NoPrefix="yes">
            <Subscribe Event="ActionData" Attribute="Text" />
        </Control>
        <Control Id="ActionText" Type="Text" X="135" Y="100" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
            <Subscribe Event="ActionText" Attribute="Text" />
        </Control>
    </Dialog>

    <DialogRef Id="ApiKeyDlg" />
    <DialogRef Id="DiskCostDlg" />
    <DialogRef Id="ErrorDlg" />
    <DialogRef Id="FatalError" />
    <DialogRef Id="FilesInUse" />
    <DialogRef Id="MsiRMFilesInUse" />
    <DialogRef Id="PrepareDlg" />
    <DialogRef Id="ProgressDlg" />
    <DialogRef Id="ResumeDlg" />
    <DialogRef Id="UserExit" />

    <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

    <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish>
    <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

    <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
    <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="ApiKeyDlg">LicenseAccepted = "1"</Publish>

    <Publish Dialog="ApiKeyDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
    <Publish Dialog="ApiKeyDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1<!--Some text field conditon here maybe?--></Publish>

    <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ApiKeyDlg" Order="1">NOT Installed</Publish>
    <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
    <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</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" />
    <!--
    <InstallUISequence>
        <Show Dialog="ApiKeyDlg" Before="VerifyReadyDlg" Overridable="no" />
    </InstallUISequence>
    -->
</UI>
<UIRef Id="MyWixUI_InstallDir" />
<UIRef Id="WixUI_Common" />

1 个答案:

答案 0 :(得分:1)

我刚刚开始工作。解决方案是将自定义对话框放在product标签之外的片段中,并清理我的UI引用,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>

...
Lots of other stuff, removed to shrink post
...


       <UI>
            <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="InstallDir" />


            <DialogRef Id="DiskCostDlg" />
            <DialogRef Id="LicenseAgreementDlg" />
            <DialogRef Id="VerifyReadyDlg" />
            <DialogRef Id="ErrorDlg" />
            <DialogRef Id="FatalError" />
            <DialogRef Id="FilesInUse" />
            <DialogRef Id="MsiRMFilesInUse" />
            <DialogRef Id="PrepareDlg" />
            <DialogRef Id="ProgressDlg" />
            <DialogRef Id="ResumeDlg" />
            <DialogRef Id="UserExit" />
            <DialogRef Id="ApiKeyDlg" />

            <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

            <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish>
            <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

            <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
            <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="ApiKeyDlg">LicenseAccepted = "1"</Publish>

            <Publish Dialog="ApiKeyDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
            <Publish Dialog="ApiKeyDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">NOT ApiKey</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ApiKeyDlg" Order="1">NOT Installed</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</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" />
            <UIRef Id="WixUI_Common" />
        </UI>
        <Property Id="WIXUI_APIKEY" Value="APIKEY" />

    </Product>

    <Fragment>
        <UI>
            <Dialog Id="ApiKeyDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
                <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
                <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>

                <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="You can find the organisation ID for this device in the dashboard." />
                <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Organisation ID required" />
                <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
                <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
                <Control Id="ApiKeyLabel" Type="Text" X="20" Y="60" Width="290" Height="10" NoPrefix="yes" Text="Organisation ID:" />
                <Control Id="ApiKey" Type="Edit" X="20" Y="75" Width="100" Height="18" Property="WIXUI_APIKEY" Indirect="yes" />
            </Dialog>
        </UI>
    </Fragment>

</Wix>