The recent development, Silverlight xap More and more large, if not optimized to seriously affect the client experience, so read some information, summed up.
The XAP package is biodegradable
Silverlight applications are ultimately the use of HTTP protocol to the web to reach the client, we write the Silverlight package is XAP, is actually a compressed package, contains a number of controls and resources, you can change the suffix to zip, through the right key to open a probe.
Change the suffix and then use the compression software to open it and discover it.
After understanding this basic knowledge, you can start the optimization work from the decomposition of this XAP package, where the optimization is divided into two parts:
Silverlight client-side caching validates the decomposition of the DLL decomposition resource for Silverlight itself
Validation of Silverlight Cache Resources
Silverlight can cache resources at the client, one download, and reuse.
This can be tested by fiddler the load of the resource.
Iii. use of Silverlight in VS2010 Select the "Application Library cache reduce XAP volume" to control the only DLLs needed to download each time.
Add a ChildWindow to the SL project, and then we'll rewrite the MainPage.xaml.cs code:
Public MainPage ()
{
InitializeComponent ();
This. Loaded + = new Routedeventhandler (mainpage_loaded);
}
void Mainpage_loaded (object sender, RoutedEventArgs e)
{
Test T = new Test ();
T.show ();
}
is to eject a child window while loading, and then compiling the solution will find:
There is a System.Windows.Controls.zip file in the ClientBin folder under the Web, this is because the above option is selected, using fiddler monitoring will find that the first load if the child window does not open, it will not load system.windows.controls.zip This bag.
Iv. Controlling picture Resources
We can set the picture resource to content and place the picture in a folder under the Web, which greatly reduces the volume of the XAP package and saves the next download by using the cached HTTP request resources from the browser, if you split the Silverlight DLL and resources away, Will reduce the volume of xap downloads and shorten the wait time, and you can use IIS to do ordinary picture downloads, using the browser's own caching capabilities to cache the first requested picture for backup.