在 WiX 中的对话框之间插入自定义操作 (InstallUISequence) [英] Inserting Custom Action between Dialogs (InstallUISequence) in WiX

查看:16
本文介绍了在 WiX 中的对话框之间插入自定义操作 (InstallUISequence)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个自定义对话框(加上必需的 ExitDlgFatalErrorDlg 等),第一个使用 Edit 控件设置属性,第二个使用 Text 控件显示此属性.这是有意义的代码:

I have two custom dialog boxes (plus the required ones ExitDlg, FatalErrorDlg, etc.), the first one sets a property using an Edit control and the second one shows this property using a Text control. Here is the meaningful code:

<Dialog Id="DialogA" ...>
  <Control Id="ControlEdit" Type="Edit" Property="MY_PROPERTY" .../>
  <Control Id="ControlNext" Type="PushButton" ...>
    <Publish Event="EndDialog" Value="Return" /></Control>
</Dialog>

然后是第二个对话框:

<Dialog Id="DialogB" ...>
  <Control Id="ControlText" Type="Text" Text="[MY_PROPERTY]" .../>
  <Control Id="ControlBack" Type="PushButton" ...>
    <Publish Event="EndDialog" Value="Return" /></Control>
  <Control Id="ControlNext" Type="PushButton" ...>
    <Publish Event="EndDialog" Value="Return" /></Control>
</Dialog>

以及动作顺序:

<InstallUISequence>
   <Show Dialog="DialogA" Before="MyCustomAction" />
   <Custom Action="MyCustomAction" Before="DialogB" />
   <Show Dialog="DialogB" Before="ExecuteAction" />
</InstallUISequence>

自定义操作会更改 MY_PROPERTY 的值.我的问题是如何使 DialogB 中的后退按钮返回到 DialogA.使用 NewDialog 很简单,但是我无法在对话框之间执行自定义操作,或者我可以吗?

The custom action changes the value of MY_PROPERTY. My problem is how to make the Back button in DialogBget back to DialogA. Using NewDialog is simple, but then I can't get the custom action to be executed between the dialogs, or can I?

编辑 - 2013-05-02

在@caveman_dick 的回答之后,我几乎像他说的那样尝试更改DialogA,但我没有使用EndDialog,而是更改为Action="新对话框"Value="DialogB".但是现在没有调用自定义操作.如果我删除 Publish 事件以转到下一个对话框,则调用 CA.如果我按照@caveman_dick 所说的那样离开,我将无法从 DialogB 回到 DialogA.

After the answer from @caveman_dick, I tried to change the DialogA almost like he said, but instead of using EndDialog, I changed to Action="NewDialog" Value="DialogB". But now the Custom Action isn't being called. If I remove the Publish event to go to next dialog, then the CA is called. If I leave as @caveman_dick said, I can't get back to DialogA from DialogB.

编辑 - 2013-05-02

WiX 3.6:Windows Installer XML 开发人员指南一书中搜索后,我发现了以下内容:如果您有多个 Publish 事件,它们必须有条件语句作为其内部文本.否则,所有事件都不会发布."

After searching in book WiX 3.6: A Developer's Guide to Windows Installer XML, I found the following: "if you have more than one Publish event, they must have conditional statements as their inner text. Otherwise, all of the events simply won't be published."

所以@caveman_dick 的答案是正确的,只是你需要更改为以下内容:

So the answer from @caveman_dick is correct, except that you need to change to the following:

<Publish ...>1</Publish>

推荐答案

而不是在 InstallUISequence 中安排自定义操作,您可以在按钮单击时发布它:

Rather than scheduling the custom action in the InstallUISequence you can publish it on the button click:

<Dialog Id="DialogA" ...>
   <Control Id="ControlEdit" Type="Edit" Property="MY_PROPERTY" .../>
   <Control Id="ControlNext" Type="PushButton" ...>
       <Publish Event="DoAction" Value="MyCustomAction">1</Publish>
       <Publish Event="EndDialog" Value="Return">1</Publish>
   </Control>
</Dialog>

Publish 元素的条件需要显式评估为 true 才能运行,因此添加 "1" 作为 Publish 的文本元素.

The Publish element's condition needs to explicitly evaluate to true to run, so add "1" as the text of the Publish elements.

这篇关于在 WiX 中的对话框之间插入自定义操作 (InstallUISequence)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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