wix - Text template stop working after manual edit -
in installer want user connect database. support 4 database types in product. in connect database dialog created, there combobox control supported database types, edit control user suppose enter connection string , pushbutton, when pressed show connection string text template in edit control according selected database type in combobox. now, problem is:
- user clicks show template button when mssql selected
- user alters manually place holder in text template connection string in edit control
- user realize needs mysql connection
- user change value in combobox mysql , clicks show template button , nothing happens.
to summarize this, after edit control manually altered, show template stops working.
here wix code use:
<fragment> <!-- supported databases templates --> <property id="mssqltemplate" value="data source=localhost;initial catalog=[database];integrated security=yes"/> <property id="mysqltemplate" value="server=localhost;uid=[username];pwd=[password];database=[database];" /> <property id="db2template" value="server=localhost;uid=[username];pwd=[password];database=[database];" /> <property id="oracletemplate" value="data source=[database];user id=[username];password=[password];" /> <property id="prop_database_type">mssql</property> <property id="prop_connectionstring"></property> <binary id="ca_dll" sourcefile="$(var.customactions.targetdir)customactions.ca.dll" /> <customaction id="cashowtemplate" binarykey="ca_dll" dllentry="showtemplate" execute="immediate" /> <ui id="installdlg_ui"> <textstyle id="tahoma_regular" facename="tahoma" size="8" /> <property id="defaultuifont" value="tahoma_regular" /> <dialog id="installdlg" width="370" height="270" title="amazing software" nominimize="no"> <!-- database type --> <control id="lbldatabasetype" type="text" x="20" width="100" y="60" height="18" noprefix="yes" text="database type" /> <control id="cbdatabaseserver" type="combobox" x="120" width="90" y="60" height="18" property="prop_database_type" combolist="yes" sorted="yes"> <combobox property="prop_database_type"> <listitem text="mssql" value="mssql" /> <listitem text="mysql" value="mysql" /> <listitem text="oracle" value="oracle" /> <listitem text="db2" value="db2" /> </combobox> </control> <control id="btnshowtemplate" type="pushbutton" x="215" y="60" width="85" height="17" text="show template"> <publish event="doaction" value="cashowtemplate" order="1">1</publish> <publish property="prop_connectionstring" value="[prop_connectionstring]" order="2">1</publish> </control> <!-- connection string --> <control id="lblconnectionstring" type="text" x="20" width="100" y="85" height="18" noprefix="yes" text="connection string" /> <control id="tbconnectionstring" type="edit" x="120" width="180" y="85" height="18" property="prop_connectionstring" text="[prop_connectionstring]" /> <control id="cancelbutton" type="pushbutton" text="cancel" height="17" width="56" x="180" y="243" cancel="yes"> <publish event="enddialog" value="exit" /> </control> </dialog> <installuisequence> <show dialog="installdlg" before="executeaction" /> </installuisequence> </ui> </fragment>
and custom action written in c#:
[customaction] public static actionresult showtemplate(session session) { string selecteddatabase = string.format("{0}template", session["prop_database_type"]); session["prop_connectionstring"] = session[selecteddatabase]; return actionresult.success; }
what doing wrong?
your code doesn’t have issue. well-known limitation of wix ui. check below discussions more details.
Comments
Post a Comment