添加自定义单选按钮以设置ALLUSERS属性

时间:2014-05-14 15:22:10

标签: wix windows-installer wix3.8

我希望能够将ALLUSERS属性设置为当前用户为空白,或者使用位于“目标文件夹”中的两个单选按钮将所有用户设置为1。对话。

我知道这是为当前用户运行的代码:

<Property Id="AllUSERS" Value="{}"/>

并且适用于所有用户:

<Property Id="AllUSERS" Value="1"/>

我已经有了这段代码来创建自定义单选按钮:

<Control Id="RadioButtonGroupID" Type="RadioButtonGroup" X="30" Y="94" Width="305" Height="100" Property=" VARIABLETOSTORESTATE " Text="This is My Group">
    <RadioButtonGroup Property="VARIABLETOSTORESTATE">
    <RadioButton Value="1" X="0" Y="0" Width="200" Height="10" Text="State 1" />
    <RadioButton Value="2" X="0" Y="20" Width="200" Height="10" Text="State 2" />
    </RadioButtonGroup>
</Control>

但是,我不知道我应该把它放在我的Wix代码中。

任何帮助都会非常感谢。

1 个答案:

答案 0 :(得分:2)

您需要创建自己的对话框窗口,其中包含单选按钮。这是一个很好的教程:http://wix.tramontana.co.hu/tutorial/user-interface-revisited/a-single-dialog

这是一个极简主义的例子。这样,安装程序的UI将只包含一个带有单选按钮和按钮的对话框&#34;安装&#34;:

<UI>
  <Dialog Id="RbDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
    <Control Id="RadioButtonGroupID" Type="RadioButtonGroup" X="30" Y="94" Width="305" Height="100" Property=" VARIABLETOSTORESTATE " Text="This is My Group">
    <RadioButtonGroup Property="VARIABLETOSTORESTATE">
    <RadioButton Value="1" X="0" Y="0" Width="200" Height="10" Text="State 1" />
    <RadioButton Value="2" X="0" Y="20" Width="200" Height="10" Text="State 2" />
    </RadioButtonGroup>
    </Control>

    <Control Id="Install" Type="PushButton" X="304" Y="243" Width="56" Height="17"
                Default="yes" Text="Install">
      <Publish Event="EndDialog" Value="Return" />
    </Control>
  </Dialog>
  <InstallUISequence>
    <Show Dialog="RbDlg" Before="CostInitialize" />
  </InstallUISequence>
</UI>

当然,您可以在现有的Wix对话框中添加此对话框。也许您已经使用例如:

来调用这样的UI
<UIRef Id="WixUI_Mondo" />

这是一个很好的介绍:http://www.packtpub.com/article/windows-installer-xml-wix-adding-user-interface

以下是一些节省时间的提示:在上面的教程中,请注意每个对话框如何使用&#34; next&#34;和&#34;返回&#34;按钮:

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

在对话框中,您还可以创建&#34; next&#34;和&#34;返回&#34;纽扣。 Ofc最后一个对话框有一个&#34; Finish&#34;按钮而不是&#34; next&#34;。

互联网上有很多关于如何跳过许可协议对话框的例子(如this one)。这些是关于如何更改安装UI序列的良好基本示例。如果您能够理解这些示例,那么您将有足够的知识将自定义对话框添加到安装UI序列中。这不是很难学,也很强大。祝你好运!