简体   繁体   English

Windows Installer工具包(WIX)对话框条件不起作用

[英]Windows Installer Toolkit (WIX) Dialog Condition not working

this thing drives me mad. 这件事使我发疯。

What I have is a custom Exit dialog with some controls on it. 我所拥有的是一个自定义退出对话框,上面带有一些控件。 Here is the source: 来源如下:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <UI>
            <Dialog Id="MyExitDialog" Width="370" Height="220" Title="!(loc.ExitDialog_Title)">
                <Control Id="Finish" Type="PushButton" X="236" Y="200" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIFinish)" />
                <Control Id="Cancel" Type="PushButton" X="304" Y="200" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUICancel)" />
                <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.DiskCostDlgBannerBitmap)" />
                <Control Id="InstallText" Type="Text" X="25" Y="53" Width="330" Height="50" Text="Product [ProductName] was successfully installed" >
                    <Condition Action="show">NOT Installed</Condition>
                </Control>
                <Control Id="UninstallText" Type="Text" X="25" Y="53" Width="330" Height="50" Text="Product [ProductName] was successfully removed." >
                    <Condition Action="show">Installed</Condition>
                </Control>
                <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
                <Control Id="Back" Type="PushButton" X="180" Y="200" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
                <Control Id="BottomLine" Type="Line" X="0" Y="190" Width="370" Height="0" />
                <Control Id="Description" Type="Text" X="25" Y="23" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogDescription)" />
                <Control Id="Title" Type="Text" X="15" Y="6" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" />
                <Control Id="LaunchAfterExitCheckBox" Type="CheckBox" X="25" Y="145" Width="330" Height="18" CheckBoxValue="1" Property="LAUNCHAFTEREXIT" Text="Run application after installation" >
                    <Condition Action="show">NOT Installed</Condition>              
                </Control>
            </Dialog>
            <InstallUISequence>
                <Show Dialog="MyExitDialog" OnExit="success" Overridable="yes" />
            </InstallUISequence>
            <AdminUISequence>
                <Show Dialog="MyExitDialog" OnExit="success" Overridable="yes" />
            </AdminUISequence>
        </UI>
    </Fragment>
</Wix>

Those of you beeing familiar with the WIX sources will easily recognize that I have cloned the ExitDialog contained in WIX, and given it the same layout as almost all other dialogs (horizontal banner on top), to work around the "letterbox" bug (Windows background shining through controls). 那些熟悉WIX源代码的人会很容易认识到,我已经克隆了WIX中包含的ExitDialog,并赋予它几乎与所有其他对话框相同的布局(顶部为水平横幅),以解决“ letterbox”错误(Windows)通过控件闪闪发光的背景)。 Now the problem is, that die "Launch application" Checkbox does appear on install and on uninstall, seems the condition has no effect. 现在的问题是,安装和卸载时确实出现了“启动应用程序”复选框,看来情况没有任何效果。 I can, however, successfully tick and untick the checkbox by setting the LAUNCHCONDITION property, so tehre is some live in this thing. 但是,通过设置LAUNCHCONDITION属性,我可以成功勾选和取消勾选该复选框,所以这是一件活的事。 The whole issue is somewhat weird, because 10 lines futher up I use the exactly same condition to switch texts between "InstallText" and "UninstallText", and this works just fine. 整个问题有些怪异,因为再往前10行,我使用完全相同的条件在“ InstallText”和“ UninstallText”之间切换文本,所以效果很好。

This is the original code from the ExitDialog: 这是ExitDialog中的原始代码:

<Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">
    <Condition Action="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND NOT Installed</Condition>
</Control>

OK, they have another condition AND-ed, which doesn't exist in my project, but so what? 好的,它们还有另一个条件AND,在我的项目中不存在,但是那又是什么呢? My condition should work nicely, but it doesn't. 我的病情应该很好,但事实并非如此。 I have been staring at those few lines for hours now, and tried this and that, no success. 我已经盯着那几行看了几个小时了,尝试了这一点,但没有成功。

What am I missing??? 我在想什么???

Thx, Armin. 谢谢,阿明。

Your conditions are on "show" actions. 您的条件取决于“显示”操作。 However, all controls start visible, so what you really need are actions to hide them. 但是,所有控件都开始可见,因此您真正需要的是隐藏它们的操作。 It's not a bad idea to have both actions on each control with complementary conditions (that is, to keep your show actions), although in this case it likely won't matter. 在具有互补条件的每个控件上同时具有两个动作(也就是保持您的显示动作),这不是一个坏主意,尽管在这种情况下,这可能无关紧要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM