wix - 在延迟的自定义操作中读取复选框值
问题描述
我正在开发一个安装程序,我必须为用户添加一个对话框以进行一些应用程序配置选择。该对话框显示在安装过程之前,并且配置选择只能在安装后安装所需文件时应用。所需文件是某种配置文件,必须根据所选配置进行调整。
顺序如下:
- 启动安装程序
- 选择安装文件夹
- 选择所需的配置
- 安装应用程序
- 根据选择的所需配置更改配置
配置对话框将有 2 个组件:一个复选框和一个下拉列表。目前我正在努力使用复选框并在延迟的自定义操作中读取它的值。此自定义操作在安装完成后执行。
到目前为止,这是我拥有的代码:
<Dialog Id="TempDlgId" ...>
<Control Id="MyCheckBoxId" Type="CheckBox" ... CheckBoxValue="0" Property="MyCheckBoxValue" Text="Sampe Text"/>
</Dialog>
这是用户选择配置的对话框。
<Custom Action="MyCustomAction.SetProperties" After="InstallFiles">NOT Installed</Custom>
<Custom Action="MyCustomAction" After="MyCustomAction.SetProperties">NOT Installed</Custom>
我为我的自定义操作应用了排序。
<CustomAction Id="MyCustomAction.SetProperties"
Return="check"
Execute="immediate"
Property="MyCustomAction"
Value="InstallLocation=[DEFAULTWORKINGDIRECTORY];MyCheckBoxValue=[MyCheckBoxValue]"/>
<CustomAction Id="MyCustomAction"
Return="check"
Execute="deferred"
BinaryKey="MyCustomAction.CA.dll"
Impersonate="yes"
DllEntry="MyCustomAction"
HideTarget="no"/>
这是我对自定义操作的定义。
[STAThread]
[CustomAction]
public static ActionResult MyCustomAction(Session session)
{
Debugger.Launch();
var installLocation = session.CustomActionData["InstallLocation"];
var hasModule = session.CustomActionData["MyCheckBoxValue"];
return ActionResult.Success;
}
此代码必须更改已安装应用程序的配置,目前我正在努力获取复选框值。复选框是否选中并不重要,MyCheckBoxValue
始终为空。是否可以在延迟操作中获取复选框的值?如果可能,我该怎么做才能获得复选框值?
解决方案
由于我不熟悉安装程序,因此我不熟悉大写字母实际上具有使用 WiX 创建安装程序的功能这一事实。一旦我MyCheckBoxValue
完全用大写字母书写,它就变成了一个公共属性,我设法在延迟的自定义操作中获得了它的价值。
推荐阅读
- java - 限制 Tika 中要解析的 Embedded 文件的数量
- php - 在我的 HTML 表单上允许使用 PHP 的某些文件类型不起作用
- python - 如何匹配python中运行时间过长的所有键值对
- struts2 - Struts2 从文本字段中迭代值
- performance - 根据具体情况指定 webpack “mainFields”
- angular - JavaScript '最大安全整数' | 大数(数字 > 16)被 0 替换
- ios - 如何通过 Java(Spring Boot)使用 FCM 向 iOS 设备发送通知/消息?
- reporting-services - 在 SSRS 中导出 excel 时如何添加额外的行和文本
- reactjs - 如何填充 React Formik 表单?
- visual-studio-code - VSCode插入“不间断空格”而不是常规空格