成功后动态更改 EndDialog 中的 RTF 内容 [英] Dynamically changing RTF content in the EndDialog after success

查看:24
本文介绍了成功后动态更改 EndDialog 中的 RTF 内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多亏了这个


打开 MSI 日志:我这里有另一个示例,用于说明如何从上一个 MSI 对话框中打开 MSI 日志:https://github.com/glytzhkof/WiXOpenLogFile(在没有正确理解需求的情况下首次制作 - 但一直想要这个功能 - 它没有完成,而是一个功能演示).

(如果没有创建 MSI 日志,则有一个功能可以隐藏打开的日志复选框 - 使用 Enable Global MSI Logging.reg 文件来启用 MSI 日志记录所有 MSI 操作.日志以随机名称显示在 TEMP 文件夹中.)


链接部分:

WiX GUI 既是 MSI 文件中嵌入的 MSI GUI,也是 Burn setup.exe 启动器 GUI,可以使用许多不同的现代技术.所以 MSI GUI 与 setup.exe GUI.

WiX GUI 上的一些选定链接:

Thanks to this question, I was able to make a custom action that temporary update and modifies the MSI Database on the fly.

In a nutshell I am doing

[CustomAction]
public static ActionResult VerifyLog(Session session)
{
  var sRtfText = @"{\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}THIS IS NOT DEFAULT TEXT}";
  var view = session.Database.OpenView("SELECT * FROM Control WHERE 
  Dialog_='EndDlg' AND Control='Verification'");
  view.Execute();
  var record = view.Fetch();
  view.Delete(record);
  record.SetString("Text", sRtfText);
  view.InsertTemporary(record); // also tried original post's view.Modify(ViewModifyMode.InsertTemporary, record); as well

  return ActionResult.Success;
}

and my default state of the Control is following

<Dialog Id="EndDlg" Width="600" Height="400" Title="$(var.PRODUCT_NAME)">
  <Control Id="Verification" Type="ScrollableText" X="180" Y="80" Width="410" Height="280" Sunken="yes" TabSkip="no" Text="{\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}default text\line}"/>
  <!-- Buttons for Navigation... -->
</Dialog>

My CustomAction element is following.

  <CustomAction Id="CA_01_Verify"
                BinaryKey="WiXCustomAction"
                DllEntry="VerifyLog"
                Execute="immediate"
                Return="check"/>

My InstallExecuteSequence is following.

  <InstallExecuteSequence>
    <Custom Action="CA_01_Verify" Before="CostInitialize"></Custom>
  </InstallExecuteSequence>

However, upon the End Dialog is opened on exit via <Show Dialog="EndDlg" OnExit="success"/>, somehow, the updated text is gone and the control only displays the default text.

When I do check for the text column, in the custom action, I can see that it has been updated properly. (I checked ahead of modification via CA to make sure default WAS there and IS UPDATED).

Just for the sake of it I made another custom action that just checks for the Text entry in the EndDlg Verification Control and I confirmed that the Text column for Verification Control is properly updated.

If it is updated properly in the table, why is it not updated on the UI?

Just as a reference followings are the result log

Action 11:49:35: CA_01_Verify. 
Action start 11:49:35: CA_01_Verify.
MSI (s) (2C:A8) [11:49:35:044]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSIAC6F.tmp, Entrypoint: VerifyLog
MSI (s) (2C:C8) [11:49:35:045]: Generating random cookie.
MSI (s) (2C:C8) [11:49:35:057]: Created Custom Action Server with PID 26272 (0x66A0).
MSI (s) (2C:80) [11:49:35:086]: Running as a service.
MSI (s) (2C:80) [11:49:35:089]: Hello, I'm your 32bit Impersonated custom action server.
SFXCA: Extracting custom action to temporary directory: C:\WINDOWS\Installer\MSIAC6F.tmp-\
SFXCA: Binding to CLR version v4.0.30319
Calling custom action WiXCustomAction!WiXCustomAction.CustomActions.VerifyLog
VerifyLog started
MSI (s) (2C!90) [11:49:35:230]: PROPERTY CHANGE: Adding VerifyLog property. Its value is 'Started'.
Opening the view from control table
view.Execute()
view.Fetch()
Current Text Column: {\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}default text\line}
view.Delete()
setting the text with rtf content : {\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}THIS IS NOT DEFAULT TEXT}
Current Text Column Before set string : {\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}default text\line}
Current Text Column After set string : {\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}THIS IS NOT DEFAULT TEXT}
view.Modify
Current Text Column Before Insert: {\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}THIS IS NOT DEFAULT TEXT}
Current Text Column After Insert: {\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}THIS IS NOT DEFAULT TEXT}
Success

解决方案

There is a mock-up example checked into github.com here: https://github.com/glytzhkof/WiXViewLogExperiment

This sample features a spawned dialog from a custom setup ExitDialog (called MyExitDialog) which shows the content of an RTF file. Please replace the "TestFile.rtf" on disk with your own RTF file and just compile and run the resulting MSI to check how this works.


Open MSI Log: I have another sample here for how to open the MSI log from the last MSI dialog: https://github.com/glytzhkof/WiXOpenLogFile (made first without understanding requirements properly - but always wanted this feature - it is not finished, but a functional demo).

(there is a feature to hide the open log checkbox if there is no MSI log created - use the Enable Global MSI Logging.reg file to enable MSI logging for all MSI operations. The log shows up with a random name in the TEMP folder.)


Link Section:

WiX GUI is both the embedded MSI GUI inside MSI files, but also the Burn setup.exe launcher GUI that can be created with many different and modern technologies. So MSI GUI versus setup.exe GUI.

Some selected links on WiX GUI:

这篇关于成功后动态更改 EndDialog 中的 RTF 内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆