Wix:如何在运行时设置要在 VerifyReadyDlg 中显示的文本? [英] Wix: How can I set, at runtime, the text to be displayed in VerifyReadyDlg?

查看:17
本文介绍了Wix:如何在运行时设置要在 VerifyReadyDlg 中显示的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户通过设置向导并做出一些选择后,通常会显示

我不相信我可以修改 MSI 中的控制表,因为在安装过程中不允许修改.我找到了 MsiViewModifyInsertTemporary,但我不认为那也行.控制表中的相关行已经存在,并且包含静态数据.我想修改数据,就在显示 VerifyReadyDlg 之前.

解决方案

您可能无法修改 MSI 表中的现有行,但可以插入新的临时"行.

因此,在自定义操作中,在运行时,将一个或多个临时行插入到控制表中.在 Javascript 中,它看起来像这样:

var controlView = Session.Database.OpenView("SELECT * FROM Control");controlView.Execute();var record = Session.Installer.CreateRecord(12);record.StringData(1) = "VerifyReadyDlg";//Dialog_ - 要修改的对话框record.StringData(2) = "CustomVerifyText1";//Control - 任何唯一的名称都可以record.StringData(3) = "文本";//类型record.IntegerData(4) = 25;//Xrecord.IntegerData(5) = 70;//是record.IntegerData(6) = 320;//宽度record.IntegerData(7) = 65;//高度record.IntegerData(8) = 2;//属性record.StringData(9) = "";//财产record.StringData(10) = text1;//Text - 要显示的文本record.StringData(11) = "";//Control_Nextrecord.StringData(12) = "";//帮助controlView.Modify(MsiViewModify.InsertTemporary, record);controlView.Close();

您可能希望该自定义文本仅在安装时显示.在这种情况下,以同样的方式添加一个条件:

var controlCondView = Session.Database.OpenView("SELECT * FROM ControlCondition");controlCondView.Execute();record = Session.Installer.CreateRecord(4);record.StringData(1) = "VerifyReadyDlg";//对话_record.StringData(2) = "CustomVerifyText1";//Control_ - 同名record.StringData(3) = "显示";//行动record.StringData(4) = "未安装";//健康)状况controlCondView.Modify(MsiViewModify.InsertTemporary, record);controlCondView.Close();

<小时>

Msi 常量定义如下:

//http://msdn.microsoft.com/en-us/library/aa372516(VS.85).aspxvar MsiViewModify ={刷新:0,插入 : 1,更新:2,分配:3,替换 : 4,合并:5,删除 : 6,InsertTemporary : 7,//在安装过程中不能永久修改 MSI验证 : 8,验证新:9,验证字段:10,验证删除:11};

<小时>

一些注意事项:

  1. Control 表中的InstallText 正常显示.可以使用 .wxl 文件对其进行自定义,插入如下内容:

    随便.

    这会导致控制表中出现一行.但是您不能在运行时从表中删除行.
    如果您为新自定义文本选择与静态 InstallText 相同的 X、Y 和高度、宽度,则 InstallText 将被遮挡.

  2. 使用未安装"作为条件似乎违反直觉 - 但请记住,这是运行安装向导之前的世界状态.如果在运行向导之前 Installed MSI,那么您可能没有安装它,这意味着您不需要显示在向导中所做的选择.

  3. 当然您可以通过这种方式添加多个控件.您可以添加多个文本控件,或者...您可以添加行、按钮、复选框等.对于每一个,您都必须适当地设置控件类型和几何形状.使用 Orca 检查控制表以找出方法.

  4. 这种方法适用于任何对话框.在呈现对话框之前,您只需确保在 InstallUISequence 中的某个点运行自定义操作以将临时行插入到控制表中.

After the user goes through the Setup Wizard, and makes a few choices, the usual thing is to display the VerifyReadyDlg to say "Are you ready to install?"

The built-in VerifyReadyDlg is static. It does not present a summary of the choices he made previously. I'd like to modify it so that it does.

How can I do that?


Example

"Static" text:

Intelligent text:

I don't believe I can modify the Control table in the MSI, because mods during the installation process are not allowed. I found MsiViewModifyInsertTemporary, but I don't think that will work either. The relevant row in the Control table is already present, and it contains static data. I want to modify the data, just before VerifyReadyDlg is displayed.

解决方案

You may not be able to modify existing rows in the MSI tables, but you can insert new "temporary" rows.

So, in a custom action, at runtime, insert one or more temporary rows into the Control table. In Javascript, it looks like this:

var controlView = Session.Database.OpenView("SELECT * FROM Control");
controlView.Execute();

var record             = Session.Installer.CreateRecord(12);
record.StringData(1)   = "VerifyReadyDlg";    // Dialog_ - the dialog to mod
record.StringData(2)   = "CustomVerifyText1"; // Control - any unique name will do
record.StringData(3)   = "Text";              // Type
record.IntegerData(4)  = 25;                  // X
record.IntegerData(5)  = 70;                  // Y
record.IntegerData(6)  = 320;                 // Width
record.IntegerData(7)  = 65;                  // Height
record.IntegerData(8)  = 2;                   // Attributes
record.StringData(9)   = "";                  // Property
record.StringData(10)  = text1;               // Text - the text to be displayed
record.StringData(11)  = "";                  // Control_Next
record.StringData(12)  = "";                  // Help
controlView.Modify(MsiViewModify.InsertTemporary, record);
controlView.Close();    

You probably want that custom text to be displayed only upon INSTALL. In that case, add a condition, in the same way:

var controlCondView    = Session.Database.OpenView("SELECT * FROM ControlCondition");
controlCondView.Execute();

record                 = Session.Installer.CreateRecord(4);
record.StringData(1)   = "VerifyReadyDlg";    // Dialog_
record.StringData(2)   = "CustomVerifyText1"; // Control_ - same name as above
record.StringData(3)   = "Show";              // Action
record.StringData(4)   = "NOT Installed";     // Condition
controlCondView.Modify(MsiViewModify.InsertTemporary, record);
controlCondView.Close();


The Msi constants are defined like this:

// http://msdn.microsoft.com/en-us/library/aa372516(VS.85).aspx
var MsiViewModify = 
{
    Refresh          : 0,
    Insert           : 1,
    Update           : 2,
    Assign           : 3,
    Replace          : 4,
    Merge            : 5,
    Delete           : 6,
    InsertTemporary  : 7,   // cannot permanently modify the MSI during install
    Validate         : 8,
    ValidateNew      : 9,
    ValidateField    : 10,
    ValidateDelete   : 11
};


A couple notes:

  1. The InstallText in the Control table is normally displayed. It can be customized with a .wxl file, inserting something like this:

    <String Id="VerifyReadyDlgInstallText">Whatever.</String>

    This results in a row in the Control table. But you cannot remove rows from the table at runtime.
    If you choose the X,Y and Height,Width for your new custom text to be the same as for the static InstallText, the InstallText will be obscured.

  2. It may seem counter-intuitive to use "NOT Installed" as the condition - but remember, this is the state of the world prior to running the Setup Wizard. If the MSI is Installed prior to running the Wizard, then you're probably not installing it, which means you don't need to display the choices being made in the wizard.

  3. Of course you can add multiple controls this way. You could add multiple Text controls, or...You can add lines, buttons, checkboxes, whatever. For each one, you'll have to set the control type and geometry appropriately. Use Orca to examine the Control table to figure out how.

  4. This approach works for any Dialog. You only have to be sure to run the custom action to insert the temp rows into the Control table, at some point in the InstallUISequence, before the Dialog is rendered.

这篇关于Wix:如何在运行时设置要在 VerifyReadyDlg 中显示的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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