Intersoft ClientUI 8 > ClientUI Fundamentals > Application Framework Overview > Application Framework How-to Topics > How-to: Launch a Window in External ApplicationPackage |
This example shows how to launch a UXWindow that located in an external ApplicationPackage.
In a windowing application, you typically launch an application from shortcut, or from task bar. In ClientUI, you use UXDesktopDock to provide the user interface that represents both task bar and application bar. Using the desktop dock control, you can add a button that opens a window by simply specifying the URI of the physical XAML of the window to its ApplicationUri property, similar to the semantics used in navigation framework described above.
ClientUI Windowing Framework integrates to the application framework in the way the ApplicationUri property works. Beside a local URI, you can also assign the URI of the target external package in the ApplicationUri property.
The following code example shows the page of the root application that contains a UXDesktopDock and several buttons that opens the UXWindow based on the given target URI.
XAML |
Copy Code
|
---|---|
<Intersoft:UXDesktopDock x:Name="desktopDock"> <Intersoft:UXDesktopDockButton Text="Local Application" Icon="/Images/App1.png" ApplicationUri="/Views/LocalWindow.xaml"/> <Intersoft:UXDockSeparator/> <Intersoft:UXDesktopDockButton Text="Application 1" Icon="/BookShelf.png" ApplicationUri="ExternalClientUIApp2.xap" /> </Intersoft:UXDesktopDock> |
The above example presumes that a ExternalClientUIApp2.xap file existed in the ClientBin of the Web project, which should be the same folder where the root application existed. |
In the above example, the ExternalClientUIApp2 package has its MainType assigned to a type that implements IWindow interface such as UXWindow. This enables the windowing framework to automatically dispatch the main type after the package was downloaded, then construct an instance and display the window to the desktop, as if the window were existed locally.
The following example shows the XML metadata definition of the ExternalClientUIApp2 used in the above example, followed with the XAML page of the window.
SAFMetadata.xml |
Copy Code
|
---|---|
<ApplicationPackage xmlns="http://intersoft.clientui.com/schemas" ID="ExternalClientUIApp2" Name="ExternalClientUIApp2" MainType="ExternalClientUIApp2.UXWindow1"> </ApplicationPackage> |
UXWindow1.xaml |
Copy Code
|
---|---|
<Intersoft:UXWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:Intersoft="http://intersoft.clientui.com/schemas" x:Class="ExternalClientUIApp2.UXWindow1" Header="My Application Window" d:DesignWidth="640" d:DesignHeight="480"> <Grid x:Name="LayoutRoot"> <Intersoft:UXMenuBar HorizontalAlignment="Left" Name="uXMenuBar1" VerticalAlignment="Top" Width="640"> <Intersoft:UXMenuItem Header="File" HorizontalAlignment="Left" VerticalAlignment="Top"> <Intersoft:UXMenuItem Header="New" HorizontalAlignment="Left" VerticalAlignment="Top" /> </Intersoft:UXMenuItem> <Intersoft:UXMenuItem Header="Edit" HorizontalAlignment="Left" VerticalAlignment="Top" /> </Intersoft:UXMenuBar> <Intersoft:UXToolBar Name="uXToolBar1" VerticalAlignment="Top" Margin="0,23,0,0"> <Intersoft:UXToolGroup> <Intersoft:UXToolBarButton Content="UXToolBarButton" DisplayMode="Image" Icon="/ExternalClientUIApp2;component/Assets/Images/CopyHS.png" /> <Intersoft:UXToolBarButton Content="UXToolBarButton" DisplayMode="Image" Icon="/ExternalClientUIApp2;component/Assets/Images/PasteHS.png" /> </Intersoft:UXToolGroup> </Intersoft:UXToolBar> <Intersoft:GlassLabel Content="This window is loaded dynamically from external application package." HorizontalAlignment="Center" Name="glassLabel1" VerticalAlignment="Center" /> </Grid> </Intersoft:UXWindow> |
To learn how to create a new Silverlight/WPF application using ClientUI project templates installed in Visual Studio 2010, see Introduction to ClientUI Project Templates.