加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

在WiX中的对话框(InstallUISequence)之间插入自定义操作

发布时间:2020-12-13 20:40:02 所属栏目:Windows 来源:网络整理
导读:我有两个自定义对话框(加上必需的对话框ExitDlg,FatalErrorDlg等),第一个使用Edit控件设置属性,第二个使用Text控件显示此属性.这是有意义的代码: Dialog Id="DialogA" ... Control Id="ControlEdit" Type="Edit" Property="MY_PROPERTY" .../ Control Id="C
我有两个自定义对话框(加上必需的对话框ExitDlg,FatalErrorDlg等),第一个使用Edit控件设置属性,第二个使用Text控件显示此属性.这是有意义的代码:
<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的值.我的问题是如何使DialogBget中的Back按钮返回到DialogA.使用NewDialog很简单,但是我无法在对话框之间执行自定义操作,或者我可以吗?

编辑 – 2013-05-02

在@caveman_dick的答案之后,我试图改变DialogA,就像他说的那样,但是我没有使用EndDialog,而是改为Action =“NewDialog”Value =“DialogB”.但是现在没有调用自定义操作.如果我删除发布事件以转到下一个对话框,则会调用CA.如果我离开@caveman_dick说,我无法从DialogB回到DialogA.

编辑 – 2013-05-02

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

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

<Publish ...>1</Publish>
您可以在按钮单击上发布自定义操作,而不是在InstallUISequence中安排自定义操作:
<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元素的文本.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读