News

WiX Service Account Dialog

2008-05-30 09:21:41 by Kjell-Åke Gafvelin

In my current project we had a need to be able to enter the service account details during setup for the service which is hosting our WCF services. I couldn't find a dialog that does this using WiX so I created my own.

image

In my setup project I used the WIXUI_FeatureTree template as a base. To "hook in" the new dialog you will have to override the template because if you just add new Publish elements they will not override the existing elements.

 

   1:      <UIRef Id="WixUI_ErrorProgressText"/>
   2:      <UIRef Id="WixUI_Common" />
   3:   
   4:      <Binary Id="WarningIcon" SourceFile="warning.bmp"/>
   5:      
   6:      <UI Id="MyWixUI_FeatureTree">
   7:        <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
   8:        <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
   9:        <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
  10:   
  11:        <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
  12:        <Property Id="WixUI_Mode" Value="FeatureTree" />
  13:   
  14:        <DialogRef Id="ErrorDlg" />
  15:        <DialogRef Id="FatalError" />
  16:        <DialogRef Id="FilesInUse" />
  17:        <DialogRef Id="MsiRMFilesInUse" />
  18:        <DialogRef Id="PrepareDlg" />
  19:        <DialogRef Id="ProgressDlg" />
  20:        <DialogRef Id="ResumeDlg" />
  21:        <DialogRef Id="UserExit" />
  22:   
  23:        <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
  24:   
  25:        <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
  26:   
  27:        <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
  28:        <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg">LicenseAccepted = "1"</Publish>
  29:   
  30:        <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">Installed</Publish>
  31:        <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg" Order="2">NOT Installed</Publish>
  32:        <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ServiceAccountDlg" Order="1">1</Publish>
  33:   
  34:        <Publish Dialog="ServiceAccountDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">1</Publish>
  35:        <Publish Dialog="ServiceAccountDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  36:   
  37:        <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServiceAccountDlg" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
  38:        <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
  39:   
  40:        <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
  41:   
  42:        <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
  43:        <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  44:        <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  45:        <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
  46:   
  47:        <Dialog Id="ServiceAccountDlg" Width="370" Height="270" Title="[ProductName] Setup">
  48:          <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
  49:          <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
  50:            <Condition Action="disable"><![CDATA[ACCOUNT = "" OR PASSWORD = ""]]></Condition>
  51:            <Condition Action="enable">ACCOUNT &lt;&gt; "" AND PASSWORD &lt;&gt; ""</Condition>
  52:          </Control>
  53:          <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
  54:            <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
  55:          </Control>
  56:          <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
  57:          <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
  58:          <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
  59:          <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Enter service account details.">
  60:          </Control>
  61:          <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Service account" />
  62:          <Control Type="Text" Width="322" Height="26" X="25" Y="56" Id="BodyLabel" Text="Specify the logon account for the [ProductName] service." NoPrefix="yes">
  63:          </Control>
  64:          <Control Type="Text" Width="275" Height="10" X="25" Y="98" Id="AccountLabel" Text="&amp;Account name (Example: domain\user or [email protected]):" />
  65:          <Control Type="Edit" Width="194" Height="15" X="25" Y="111" Id="AccountTextbox" Property="ACCOUNT" />
  66:          <Control Type="Text" Width="275" Height="10" X="25" Y="135" Id="PasswordLabel" Text="Pa&amp;ssword:" />
  67:          <Control Type="Edit" Width="194" Height="15" X="25" Y="148" Id="PasswordTextbox" Property="PASSWORD" Password="yes" />
  68:   
  69:          <Control Width="12" Height="12" FixedSize="yes" Type="Bitmap" X="25" Y="170" Id="Warning" Text="WarningIcon"/>
  70:          <Control Id="WarningLabel" Type="Text" X="40" Y="170" Width="200" Height="40" Text="The account entered here will not be validated. Make sure that the account details entered are correct." />
  71:        </Dialog>
  72:      </UI>

|