Wix自定义操作属性不是立即可用

时间:2019-01-24 23:32:08

标签: properties wix custom-action

我有一个设置属性的Wix VBScript自定义操作,然后有一个应该基于set属性值触发的发布事件。问题似乎在于没有设置该属性,因而没有触发下一个发布事件。有人成功做过类似的事情吗?

#define PI = 3.141593
#define G = 6.67259E-11
#define g = 9.80665
#define M = 5.972E+24
#define r = 6378000
#define h = 220

#include <stdio.h>
#include <math.h>
int main(void)
{
    int value;
    value =sqrt((G/M)/(r+h))

    printf("This is the tangential speed:") value;
    return 0;
}

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:hsi="http://schemas.hyland.com/wix/UtilityExtension"> <Fragment> <Property Id="FOO" Value="0" Secure="yes" /> <CustomAction Id="Test3" Script="vbscript"> <![CDATA[ MsgBox Session.Property("FOO") ]]> </CustomAction> <CustomAction Id="Test2" Script="vbscript"> <![CDATA[ MsgBox "Test" ]]> </CustomAction> <CustomAction Id="Test1" Script="vbscript"> <![CDATA[ Session.Property("FOO") = "1" ]]> </CustomAction> </Fragment> <Fragment> <UI> <DialogRef Id="WarningModalDlg"/> <Dialog Id="BaseLawsonWebServerDlg" Width="370" Height="270" Title="Lawson LOB Broker Relay Setup"> <Control Id="label" Type="Text" X="20" Y="50" Width="200" Height="16" Text="Test" TabSkip="yes" Transparent="yes" /> <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)"> <Publish Order="1" Event="DoAction" Value="Test3">1</Publish> <Publish Order="2" Event="DoAction" Value="Test2">FOO = "1"</Publish> <Publish Order="3" Event="DoAction" Value="Test1">1</Publish> </Control> <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)"/> <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)"> <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish> </Control> </Dialog> </UI> </Fragment> </Wix> 被触发,我已经对其进行了测试。 Event="DoAction" Value="Test1"没有命中。然后Event="DoAction" Value="Test2">FOO = "1"肯定会命中并显示带有默认值的消息框。

提前谢谢!

1 个答案:

答案 0 :(得分:0)

我知道了!我习惯了UI Dialog Publish事件的相反顺序,所以我对Control publish事件也做了同样的事情。

Control Publish事件以1到x的顺序移动。

相反,发布事件应如下所示:

 <Publish Order="1" Event="DoAction" Value="Test1">1</Publish>
 <Publish Order="2" Event="DoAction" Value="Test2">FOO = "1"</Publish>
 <Publish Order="3" Event="DoAction" Value="Test3">1</Publish>