WIX工具集如何设置属性 [英] WIX Toolset How to Set a Property

查看:36
本文介绍了WIX工具集如何设置属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎应该很直观,但是到目前为止,它什么都没有.如何在我的自定义对话框首次打开时简单地设置在product.wxs中定义的属性?

This seems like it should be intuitive, but so far its been anything but. How do I simply set a property I have defined in my product.wxs when my custom dialog first opens?

我的媒体资源称为端口",其初始化为空白.我还有另一个名为"df_Port"的文件,我将其设置为"8080".(这些是在我的Product.wxs中设置的)当自定义对话框"打开时,我要将端口"设置为"df_Port".我在对话框的属性"设置设置为端口"上也有一个编辑"控件.因此,显然,用户应该能够更新端口,但是如果他们单击返回"按钮,但最终返回到此对话框,则编辑控件"的默认值应返回到"8080"

My Property is called "Port" which is initialized as blank. I have another called "df_Port", which I set to "8080". (These are set in my Product.wxs) When my Custom Dialog opens I want to set "Port" to "df_Port". I also have an Edit control on the dialog whose "Property" setting is set to "Port". So obviously the User should be able to update Port, but if they hit the "Back" button, but eventually come back to this dialog, the default value of the Edit Control should go back to "8080"

我尝试了SetProperty,但是它需要一个Before或After属性,对此我一无所知.我也尝试过创建CustomAction,但这还是行不通的:

I have tried SetProperty, but it requires a Before or After property, and I have no clue on this. I have also tried to create a CustomAction, but this hasn't worked either:

<CustomAction Id="caPort" Property="Port" Value="[df_Port]"/>

控件显示为空白,而不是"8080"

The control shows as blank, instead of "8080"

我正在使用Wix 3.9 R2

I am using Wix 3.9 R2

推荐答案

没有人回答或评论我的问题.但是,经过反复尝试,我找到了解决方案.我想如果有人遇到同样的问题,我会把它放在这里.

Nobody answered or commented on my question. However, after much trial and error I figured out a solution. I figured I'd put it up here in case somebody else had the same problem.

1)首先,我必须将属性命名为全部大写.因此,在我的product.wxs中,我声明:

1) First, I have to name properties as all Uppercase. So in my product.wxs I declare:

<Property Id="DF_PORT" Value="8080" Secure="yes"/>
<Property Id="PORT" Secure="yes"/>

2)然后,我添加一个发布标签,并附加到自定义配置对话框之前的对话框的下一步"按钮:

2) I then add a publish tag and attach to Next button of dialog preceding my custom configuration dialog:

<Publish Dialog="PrecedingDialogName" Control="Next" Property="PORT" Value="[DF_PORT]">1</Publish>

3)在我的自定义对话框中,我只是将一个Edit控件绑定到PORT属性:

3) In my custom dialog, I just bind an Edit control to the PORT property:

<Control Id="Port" Type="Edit" X="130" Y="88" Width="60" Height="16" Property="PORT" Text="{\WixUI_Font_Normal}" Integer="yes" RightAligned="yes" />

该控件将显示默认值.如果我编辑了值,然后单击返回"按钮,则步骤2将重新加载默认值,而不是记住用户键入的内容.

The control will display the default value. If I edit the value, but then hit the "Back" button, Step 2 will reload the default value, instead of remembering what the User had typed.

在使用WIX Toolset几周之后,老实说,这是我见过的最糟糕,最不直观的开发作品之一!

After working with WIX Toolset for a couple of weeks now, I can honestly say that this is one of the worst and most unintuitive development pieces I have ever seen!

这篇关于WIX工具集如何设置属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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