Intersoft ClientUI 8 > ClientUI Fundamentals > Application Framework Overview > Application Framework How-to Topics > How-to: Download an External ApplicationPackage |
The following example shows how to download an external ApplicationPackage using the API provided in ClientUI Application Framework.
Once an ApplicationPackage is added to the shell, you can download the application package to be further consumed by other pages in the application.
An important thing to note is the use of EnableMetadataDiscovery property. You typically set it to True, so that the application package definition from SAFMetadata.xml in the external package is dispatched and parsed to the particular ApplicationPackage object when the download completes. However, there are certain scenarios where this behavior is not desired, such as in scenario where you already have the complete application package definition which is loaded from database.
The following code example shows how to create an instance of ApplicationPackage, add to the UXShell, and perform an asynchronous download.
C# |
Copy Code
|
---|---|
// create a new ApplicationPackage that represents ExternalClientUIApp1 ApplicationPackage app = new ApplicationPackage() { ID = "ExternalClientUIApp1", Name = "ExternalClientUIApp1", Source = new Uri("ExternalClientUIApp1.xap", UriKind.RelativeOrAbsolute), EnableMetadataDiscovery = true, Size = -1 // auto detect the file size at runtime }; // add the application to the UXShell UXShell.Current.Applications.Add(app); // download the application app.Download(false); |
The above example presumes that an ExternalClientUIApp1.xap file existed in the ClientBin of the Web project, which should be the same folder where the root application existed.
To create a new ClientUI Application, you use the ClientUI project templates installed in Visual Studio 2010. For more information, see Introduction to ClientUI Project Templates.