This article describes how to build a Tool for installing a Silverlight OutOfBrowser Application in WPF.
Creating OOB Silverlight Application:
Fire up the VS 2010, create Silverlight Application and Name it SilverlightOOBApplication. The important thing to have in mind while creating an OOB Application is to uncheck the OOB Host checkbox in Silverlight application.
The above image shows how to make the OOB Silverlight application.
Creating the Silverlight OOB Application Installer:
As usual, start the VS 2010 and create a WPF application named SilverlightOOBAppInstaller as shown below.
Moreover, design the Tool like this using WPF Controls.
In this Tool, we have three buttons, two check boxes and three text blocks.
- The first check box chkOverwrite is used to check whether the install command can have the overwrite option or not.
- The second check box chkShortcut used here is to add the option with install command that tells the Silverlight to create the shortcut on desktop.
- The buttons install and emulate is used to install and emulate the Silverlight application.
- The browse button used is to select the .xap file to install.
The MasterProcess Class:
Here we are using the Process class to execute the sllauncher.exe. For that we have created a separate class called MasterProcess.
To use the Process class in the project we should add the reference System.Diagnostis as shown here.
In the above code, in the InstallOrEmulateSLOOBApp method we are setting the filename of the exe to be executed, arguments for the file and for silent execution we are setting the CreateNoWindow that avoids the Windows Command-Prompt screen.
READ MORE >>