我正在开发一个安装程序,我必须在其中添加一个对话框,供用户进行一些应用程序配置选择。该对话框显示在分期过程之前,配置选项只能在安装了所需文件的分期之后应用。所需文件是某种配置文件,必须根据所选配置进行调整。
顺序如下:
-
启动安装程序
-
选择安装文件夹
-
选择所需配置
-
安装应用程序
-
根据所选的所需配置更改配置
配置对话框将有两个组件:一个复选框和一个下拉列表。目前,我正在努力处理复选框,并在延迟的自定义操作中读取其值。此自定义操作在安装完成后执行。
到目前为止,这是我的代码:
<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
始终为空。是否可以在延迟操作中获取复选框的值?如果可能的话,我需要做什么才能获得复选框值?