3
我想在安裝過程中顯示自定義操作的進度文本。我實現了代碼WiX Progress Text for a Custom Action,但它不起作用。ProgressText不適用於WiX中的自定義操作
顯示所有其他文本(例如文件副本),ActionText表格被正確填充,並且ActionText.Action與CustomAction.Actuib值匹配。有誰知道發生了什麼問題?下面是代碼:
主要WiX工程:
<Product>
<CustomAction Id="MyCA" BinaryKey="MyCALib"
DllEntry="MyCAMethod" Execute="deferred"
Return="check" />
<InstallExecuteSequence>
<Custom Action="MyCA" Before="InstallFinalize" />
</InstallExecuteSequence>
<UI>
<UIRef Id="MyUILibraryUI" />
</UI>
</Product>
UI庫:
<Wix ...><Fragment>
<UI Id="MyUILibraryUI">
<ProgressText Action="MyCA">Executing my funny CA...
</ProgressText>
...
<Dialog Id="Dialog_Progress" ...>
<Control Id="Ctrl_ActionText"
Type="Text" ...>
<Subscribe Event="ActionData" Attribute="Text" />
</Control>
...
C#自定義操作庫:
public class MyCALib
{
[CustomAction]
public static ActionResult MyCAMethod(Session session)
{
System.Threading.Thread.Sleep(10000); // to show text
// do something
System.Threading.Thread.Sleep(10000); // to show text
return ActionResult.Success;
}
}