I want to display OpenFileDialog using C# custom Action(since WIX does not
support this). I tried this but CA is not getting fired,instead my installer
hangs. I also checked if the OpenFileDialog is hidden behind the installer
window..which is not the case.
If I comment the OpenFileDialog dialog = new OpenFileDialog(); line in my
CA, it works.

Below is my code.

<CustomAction Id="ConfigFileCA" BinaryKey="DLLFilePath"
DllEntry="GetConfigFile" Return="check" Execute="immediate"
Impersonate="no"></CustomAction>

<Publish Dialog="FileBrowseDlg" Control="Next" Event="NewDialog"
Value="VerifyReadyDlg" Order="1">1</Publish>
 <Publish Dialog="FileBrowseDlg" Control="Back" Event="NewDialog"
Value="DBConnection" Order="1">1</Publish>
<Publish Dialog="FileBrowseDlg" Control="Cancel" Event="SpawnDialog"
Value="CancelDlg" Order="1">1</Publish>
<Publish Dialog="FileBrowseDlg" Control="btnChange" Event="DoAction"
Value="ConfigFileCA" Order="1">1</Publish>

<Dialog Id="FileBrowseDlg" Width="370" Height="270" Title="OneCore v3.1
Setup" NoMinimize="yes">
     <Control Id="Next" Type="PushButton" X="236" Y="244" Width="56"
Height="17" Default="yes" Text="Next"><Publish Event="EndDialog"
Value="Return"><![CDATA[1]]></Publish></Control>
      <Control Id="Back" Type="PushButton" X="176" Y="244" Width="56"
Height="17" Cancel="yes" Text="Back"/>
      <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56"
Height="17" Cancel="yes" Text="Cancel"/>
      <Control Id="ComboLabel" Type="Text" X="25" Y="58" Width="158"
Height="10" TabSkip="no" Text="Specify the location for Configuration File
:" />
      <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374"
Height="0" />
      <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374"
Height="0" />
      <Control Type="Edit" Id="txtFilePath" Width="283" Height="15" X="30"
Y="82" Property="CONFIGFILE" Text="[CONFIGFILE]"/>
      <Control Type="PushButton" Id="btnChange" Width="56" Height="17"
X="30" Y="105" Text="Change...">
          <Publish Event="EndDialog"
Value="Return"><![CDATA[1]]></Publish></Control>
      <Control Type="Text" Id="Title" Width="95" Height="15" X="11" Y="11"
Text="Configuration File Path" />
      <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370"
Height="44" TabSkip="no" Text="!(loc.BrowseDlgBannerBitmap)"/>
</Dialog>

My C# CA:

[CustomAction]
        public static ActionResult GetConfigFile(Session session)
        {
            try
            {
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Filter = "Config File (*.xml)|*.xml";
                dialog.InitialDirectory = @"C:\";
                dialog.Title = "Select Configuration File";

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    session["CONFIGFILE"] = dialog.FileName;
                    return ActionResult.Success;
                }
                else
                    return ActionResult.Failure;
            }
            catch(Exception ex)
            {
                session["CONFIGFILE"] = ex.Message;
                return ActionResult.Failure;
            }
        }


The Log file displays following message:
Action 11:14:32: FileBrowseDlg. Dialog created MSI (c) (94:D4)
[11:14:33:838]: Doing action: ConfigFileCA MSI (c) (94:D4) [11:14:33:838]:
Note: 1: 2205 2: 3: ActionText Action 11:14:33: ConfigFileCA. Action start
11:14:33: ConfigFileCA. MSI (c) (94:74) [11:14:33:876]: Invoking remote
custom action. DLL: C:\Users\RAJ041~1.EAE\AppData\Local\Temp\MSIE92.tmp,
Entrypoint: GetConfigFile MSI (c) (94:54) 

Please guide me on how to make this work...
Thank you.
-- 
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/OpeFileDialog-C-Custom-Action-tp5860149p5860149.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to