如何在WiX中创建自定义对话框以供用户输入? [英] How do I create a custom dialog in WiX for user input?

查看:117
本文介绍了如何在WiX中创建自定义对话框以供用户输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WiX为Windows服务创建安装程序.希望在安装时可配置要安装并显示在服务"中的服务的名称.

I'm using WiX to create an installer for a windows service. It's desirable that the name of service that gets installed and displayed in Services is configurable at install time.

例如,这就是我的想法(wix xml片段):

For example, this is what I'm thinking (wix xml snip):

<ServiceInstall 
    Id="MyServiceInstaller" 
    Name="NAME_PASSED_FROM_DIALOG" 
    Type="ownProcess" 
    Start="auto" 
    ErrorControl="normal" 
    Description="My Service" 
    Account="localsystem"/> 

<ServiceControl
    Id="StartMyServiceInstaller" 
    Name="NAME_PASSED_FROM_DIALOG" 
    Start="install"
    Wait="no" />

<ServiceControl
    Id="StopMyServiceInstaller" 
    Name="NAME_PASSED_FROM_DIALOG" 
    Remove="uninstall"
    Stop="both"
    Wait="yes" />

NAME_PASSED_FROM_DIALOG是我想要连接到一个自定义对话框的东西,该对话框将创建并显示给安装服务的人员,以便他们可以设置/修改服务名称.我认为这与WIXUI_INSTALLDIR属性非常相似,该属性被设置并传递给WixUI_InstallDir对话框集.

NAME_PASSED_FROM_DIALOG is something I would like to hook up to a custom dialog that gets created and gets displayed to the person installing the service so they can set/modify the service name. I think this is very similar to the WIXUI_INSTALLDIR property that gets set and passed to the WixUI_InstallDir Dialog Set.

我的问题是:

如何创建一个自定义UI对话框,该对话框可以接受传递到安装程序运行时的用户输入?

How do I create a custom UI dialog that can accept user input which gets passed into runtime of the installer?

推荐答案

尽情享受UI!

答案的原始链接不再存在. FireGiant(Wix的维护者)一些示例过程,但并不能完全回答这个问题.还有是另一本教程(更新,2018年8月:从Wayback Machine复活的链接)在大多数情况下都可以回答该问题.

The original link to answer doesn't exist anymore. FireGiant (the maintainers of Wix) some examples for part of this process, but it's doesn't completely answer this question. There is one further tutorial (UPDATE Aug.2018: Link resurrected from Wayback Machine) that does go most of the way to answer this question.

将要发生的事情的高层次概述是:

A high level overview of what will be happening is:

  1. 创建属性
  2. 已将UI控件设置为此属性
  3. 服务上的name属性将引用该属性,即[ServiceNameProperty].

但是,这很复杂,建议创建一个新的UI对话框的方法是采用一个现有对话框,对其进行克隆,然后使用新文本进行编辑,控制并使用它来填充属性.

However this is complex, and the way that is suggested to create a new UI dialog, is to take an existing dialog, make a clone of it, and then edit with new text, controls and use it to populate the property.

这篇关于如何在WiX中创建自定义对话框以供用户输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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