Intersoft ClientUI 8 > ClientUI Fundamentals > Application Framework Overview > Application Framework How-to Topics > How-to: Map an ApplicationPackage to a Virtual URI for User-friendly Navigation |
This example shows how to use automatic mapping feature in UXFrame to support dynamic navigation scenario that loads an external ApplicationPackage at runtime.
In more complex application, there may be certain cases where you cannot define and hardcode the UriMapping such as in a common scenario. For example, consider you have a dynamic composite application where you allow users to upload their applications to the composite application. In such scenario, the application package should be dynamically mapped to the shell at runtime.
To achieve this scenario, you set the the AutoMapApplications property of the UXFrame to true. Note that the UseGlobalShell is required to be set to true as well. Subsequently, you define a unique value to the VirtualPathIdentity of your application package, such as explained in the following code example.
The following example shows how to configure the navigation frame to integrate to the application framework and automatically mapping the defined applications.
XAML |
Copy Code
|
---|---|
<Intersoft:UXFrame UseGlobalShell="true" AutoMapApplications="true"> <Intersoft:UXFrame.UriMapper> <Intersoft:UriMapper> <Intersoft:UriMapping Uri="/Home" MappedUri="/Views/Home.xaml"/> <Intersoft:UriMapping Uri="/{page}" MappedUri="/Views/{page}.xaml"/> </Intersoft:UriMapper> </Intersoft:UXFrame.UriMapper> </Intersoft:UXFrame> |
Next, you specify a unique user-friendly URI (also referred as virtual URI) to the VirtualPathIdentity property of your application package. This allows for completely dynamic scenario where the friendly URI that represents the application package can be defined in the XML metadata within the package itself, which is illustrated in the following example.
SAFMetadata.xml |
Copy Code
|
---|---|
<ApplicationPackage xmlns="http://intersoft.clientui.com/schemas" ID="ExternalClientUIApp1" Name="ExternalClientUIApp1" MainType="ExternalClientUIApp1.MainPage" VirtualPathIdentity="/App1"> </ApplicationPackage> |
With the above implementation, UXFrame is notified when a new application package is added to the UXShell. Consequently, when you navigate to the application package of which URI was dynamically mapped, UXFrame intelligently resolves the URI and map it to the target ApplicationPackage accordingly.