2

我希望能够使用放置在“目标文件夹”对话框中的两个单选按钮将 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 代码中的什么位置。

任何帮助都会非常感谢。

4

1 回答 1

2

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

这是一个极简主义的例子。这样,安装程序的 UI 将仅包含 1 个带有单选按钮和“安装”按钮的对话框:

<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

这里有一些提示可以节省你一些时间:在上面的教程中,请注意每个对话框如何使用“下一步”和“返回”按钮调用另一个对话框:

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

在您的对话框中,您还可以创建“下一步”和“返回”按钮。Ofc 最后一个对话框有一个“完成”按钮而不是“下一步”。

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

于 2014-05-22T05:45:37.587 回答