从wix中的用户选择设置属性值

时间:2010-08-27 08:10:50

标签: installer wix install

我有一个像这样的3个radiobutton的窗口(删除所有非有趣的道具):

<Control Id="Back" Type="PushButton" Text="!(loc.WixUIBack)">
   <Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" Text="!(loc.WixUICancel)">
   <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" Text="!(loc.WixUINext)">
   <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
</Control>
<Control Id="InstallTypeSelection" Type="RadioButtonGroup" Property="INSTALL_TYPE">
   <RadioButtonGroup Property="INSTALL_TYPE">
      <RadioButton Value="0" Text="InstallType A" />
      <RadioButton Value="1" Text="InstallType B" />
      <RadioButton Value="2"Text="InstallType C" />
   </RadioButtonGroup>

在“下一步”我想基于用户选择的Installtype来设置一些属性。

像这样......

if(INSTALL_TYPE == 0)
{
   REG_VALUE_AUTO_LOGIN = 0;
   REG_VALUE_TIMEOUT = 300;
}
if(INSTALL_TYPE == 1)
{
   REG_VALUE_AUTO_LOGIN = 1;
   REG_VALUE_TIMEOUT = 600;
}

这在wix中如何运作?

1 个答案:

答案 0 :(得分:11)

一周前我遇到过这样的事情。我不记得正确的语法,但它看起来像这样。根据我的口味,它不是很干净,但它应该做的工作。

<Control Id="Next" Type="PushButton" Text="!(loc.WixUINext)">
   <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
   <!-- INSTALL_TYPE == 0 -->
   <Publish Property="REG_VALUE_AUTO_LOGIN" Value="1">INSTALL_TYPE  = "0"</Publish>
   <Publish Property="REG_VALUE_TIMEOUT" Value="300">INSTALL_TYPE  = "0"</Publish>

   <!-- INSTALL_TYPE == 1 -->
   <Publish Property="REG_VALUE_AUTO_LOGIN" Value="1">INSTALL_TYPE  = "1"</Publish>
   <Publish Property="REG_VALUE_TIMEOUT" Value="600">INSTALL_TYPE  = "1"</Publish>

   <! -- FINALLY, CALL NEXT DIALOG : added by Chris Painter -->
   <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 

</Control>

我没有时间对它进行测试,但我认为这是最好的方法。 我希望它会帮助你。

干杯。