如何在显示Dialog时发布CustomAction

时间:2015-03-11 10:36:54

标签: wix

我已关注Fragment来定义我的CustomAction(实际上我的CA项目中有两种方法)

<Fragment>
    <Binary Id="FooAssembly"
            SourceFile="Foo.CA.dll" />
    <CustomAction Id="Action1"
                  BinaryKey="FooAssembly"
                  DllEntry="Action1" />
    <CustomAction Id="Action2"
                  BinaryKey="FooAssembly"
                  DllEntry="Action2" />
</Fragment>

我的Action1看起来像这样:

[Microsoft.Deployment.WindowsInstaller.CustomAction]
public static ActionResult Action1(Microsoft.Deployment.WindowsInstaller.Session session)
{
    session["value1"] = "some value";
    session["value2"] = "some value";

    return ActionResult.Success;
}

现在我需要在显示对话框时运行此CustomAction并将值value1绑定到Edit - 控件如下:

<Dialog Id="FooDlg">
    <Control Id="FooEdit"
             Type="Edit"
             Text="[value1]"
             Property="value1"
             Disabled="yes" />
</Dialog>

我的InstallUISequence看起来像这样

<InstallUISequence>
    <Show Dialog="FooDlg"
          After="CostFinalize" />
</InstallUISequence>

我在这里使用Edit - 控件,因为我需要一些边框 - Text缺少 - 因此我需要填充属性Property

我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:0)

我通过改编InstallUISequence喜欢

解决了这个问题
  <InstallUISequence>
    <Custom Action="Action1"
            After="CostFinalize" />
    <Show Dialog="FooDlg"
          After="Action1" />
  </InstallUISequence>