根据复选框安装功能 [英] Install features based on checkboxes

查看:67
本文介绍了根据复选框安装功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试做到这一点,以便当用户通过复选框选择某些内容时,将安装相应的功能。

I am trying to make it so that when the user selects something via check box, a corresponding feature will be installed.

我知道预构建的功能树Wix提供的功能,但是我正在做的其他事情却不允许我使用此功能。我很好奇如何将两者链接在一起,以便当用户选中安装功能X复选框时,当用户单击安装按钮时就安装了功能X。

I am aware of the prebuilt feature tree that Wix provides but there are some other things that I am doing that do not allow me to use this function. I am curious as to how to link the two together so that when the user selects the check box "Install Feature X", feature X is installed when the user clicks the install button.

推荐答案

我找到了解决我问题的方法。为此,我需要为每个功能创建一个复选框。

I found what it was that solves my issue. To do as I had intended, I needed to create a checkbox for each feature as so.

<Control Id="FeatureX" Type="CheckBox" X="191" Y="50" Width="140" Height="17"
     Property="FEATUREX_CHECKED" CheckBoxValue="myValue" Text="Install feature X" />
<Control Id="FeatureY" Type="CheckBox" X="191" Y="67" Width="140" Height="17"
     Property="FEATUREY_CHECKED" CheckBoxValue="myValue" Text="Install feature Y" />
<Control Id="FeatureZ" Type="CheckBox" X="191" Y="84" Width="140" Height="17"
     Property="FEATUREZ_CHECKED" CheckBoxValue="myValue" Text="Install feature Z" />

现在,一旦执行此操作,我便向每个添加了相应的发布,并使其成为条件因此,只有选中该复选框,才可以安装该功能。像这样:

Now once I did that I then added a corresponding publish to each, and made a condition that made it so that only if the check box is selected will that feature be installed. Like so:

<Control Id="Next" Type="PushButton" Text="Next" X="254" Y="243" Height="17" Width="56">
   <Publish Event="Remove" Value="ALL" Order="1">1</Publish>
   <Publish Event="AddLocal" Value="FeatureX" Order="2">
      <![CDATA[FEATUREX_CHECKED]]>
   </Publish>
</Control>



注意:



删除用于取消选择要安装的所有内容(提醒我,一旦调用UI,更改功能级别为时已晚)。

NOTE:

Remove is used to deselect everything from being installed (It was brought to my attention that once the UI is invoked, it is too late to change feature levels).

然后检查每个功能,以查看是否已选中相应的复选框,如果已选中,则将其添加到 AddLocal属性。如果要查看,则AddLocal会看起来像这样:

Then each feature is checked to see if the "corresponding checkbox" has been selected and if so adds it to the "AddLocal" Property. AddLocal would look like this if one were to look at it:

ADDLOCAL=FeatureX, FeatureY, FeatureZ...

我要做的最后一件事就是检查我的main.wxs以确保复选框中使用的FeatureID与所使用的ComponentGroupRefID相匹配:

The final thing I needed to do to get this to work was too check in my main.wxs to make sure that the FeatureID used in the checkboxes matched up with the ComponentGroupRefID used:

 <ComponentGroupRef Id="FeatureX"/>

所以有...
我再次感谢大家的帮助。如果任何人读到这篇文章时感到困惑,请随时给我打个电话,我会尽力进一步解释一下。

So there it is... I again, thank everyone for their help with this. If anyone reading this is confused by anything, please feel free to drop me a line, and I will do my best to explain things a little bit further.

这篇关于根据复选框安装功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆