如果用户没有选择任何选项,WIX如何保持安装

时间:2017-02-02 18:15:25

标签: wix

我创建了一个自定义WIX屏幕,用户可以在其中打开或关闭某些选项。如果他们选择取消选中所有选项,我不希望继续安装。

My Wix UI如下所示:

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

                <Control Id="ConfigurationServicesCheckbox" Type="CheckBox" X="20" Y="60" Width="290" Height="17" Property="INSTALLCONFIGURATIONSERVICES" CheckBoxValue="1" Text="!(loc.SELECTCONFIGURE_CONFIGSERVICE_NAME)" />
                <Control Id="AuthenicationServicesCheckbox" Type="CheckBox" X="20" Y="80" Width="290" Height="17" Property="INSTALLAUTHENICATIONSERVICES" CheckBoxValue="1" Text="!(loc.SELECTCONFIGURE_AUTHSERVICE_NAME)" />
                <Control Id="AgentDesktopCommunicatorServicesCheckbox" Type="CheckBox" X="20" Y="100" Width="290" Height="17" Property="INSTALLAGENTDESKTOPCOMMUNICATORSERVICES" CheckBoxValue="1" Text="!(loc.SELECTCONFIGURE_COMMUNICATOR_NAME)" />
            </Dialog>
        </UI>

我不确定如何在允许用户继续之前选中至少一个复选框。

1 个答案:

答案 0 :(得分:1)

您可以使用Next控件元素下的Condition。

      <Condition Action="disable"><![CDATA[SomeProperty1 = 1]]></Condition>
      <Condition Action="enable"><![CDATA[SomeProperty2 = 1]]></Condition>
      <Condition Action="show"><![CDATA[SomeProperty3 = 1]]></Condition>

在这种情况下,下一个按钮将被禁用,直到选中其中一个复选框。

您还可以通过wix检查默认许可证对话框的代码。

<Fragment>
    <UI>
        <Dialog Id="LicenseAgreementDlg" Width="370" Height="270" Title="!(loc.LicenseAgreementDlg_Title)">
            <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.LicenseAgreementDlgBannerBitmap)" />
            <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="Description" Type="Text" X="25" Y="23" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgDescription)" />
            <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgTitle)" />
            <Control Id="LicenseAcceptedCheckBox" Type="CheckBox" X="20" Y="207" Width="330" Height="18" CheckBoxValue="1" Property="LicenseAccepted" Text="!(loc.LicenseAgreementDlgLicenseAcceptedCheckBox)" />
            <Control Id="Print" Type="PushButton" X="112" Y="243" Width="56" Height="17" Text="!(loc.WixUIPrint)">
                <Publish Event="DoAction" Value="WixUIPrintEula">1</Publish>
            </Control>
            <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
            <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
                <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1</Publish>
                <Condition Action="disable"><![CDATA[LicenseAccepted <> "1"]]></Condition>
                <Condition Action="enable">LicenseAccepted = "1"</Condition>
            </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>
            <Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="140" Sunken="yes" TabSkip="no">
                <Text SourceFile="!(wix.WixUILicenseRtf=$(var.licenseRtf))" />
            </Control>
        </Dialog>
    </UI>
</Fragment>