IEDOTNETUG Silverlight Class Week 4

670 views

Published on

Applications, resources, and deployment

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
670
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

IEDOTNETUG Silverlight Class Week 4

  1. 1. Week 4 – Applications, Resources, and Deployment<br />Jim LaVine<br />jim.lavine @gmail.com<br />
  2. 2. Agenda<br />Loading the application<br />XAP files<br />Binary resources<br />Xaml resources<br />Application class<br />Application extensions<br />
  3. 3. Loading the Plugin<br />HTML <object> tag<br />Compiled Silverlight content<br />Splash / download UI<br />Error Handling<br />Fallback content<br />
  4. 4. Code Behind<br /><object id=“slPlugin” width=“100%” height=“100%<br />type=“application/x-silverlight-2”<br /> data=“data:application/x-silverlight-2,”><br /><paramname=“source” value=“client/bin/SLContent.xap” /><br /><paramname=“onerror”value=“onSilverlightError” /><br /><paramname=“minRuntimeVersion”value=“4.0.50401 .0” /><br /><paramname=“autoUpgrade”value=“true” /><br /><ahref=“http:go.microsoft.com/fwlink/?linkid=115261”<br /> style=“text-decoration: none;><br /> <imgsrc=“http:go.microsoft.com/fwlink/?linkid=108181”<br />alt=“Get Microsoft Silverlight” style=“border-style: none”/><br /></a><br /></object><br />
  5. 5. Silverlight.js<br />Benefits<br />Silverlight.IsInstalled helper<br />Can choose content at runtime<br />Disadvantages<br />More Complex<br />Extra file to download<br />Moving Target<br />
  6. 6. Using Silverlight.js<br /><script type="text/javascript" src="Silverlight.js"></script><br />…<br /><divid=“slPLaceholder”></div><br />…<br /><script type="text/javascript">    Silverlight.createObject(        "ClientBin/SLObject.xap",        document.getElementById("slPlaceholder"),        "slControl",        {width:"500" heigth:"500",        version:'4.0'},        {onError: myErrorHandler}        );</script><br />
  7. 7. XAP<br />Just a Zip<br />Main DLL<br />Dependent DLLs<br />Resources<br />Mainfest<br />Server config<br />Mime type for .xap:application/x-silverlight-app<br />
  8. 8. AppManifest.Xaml<br /><Deployment xmlns=http://schemas.microsoft.com/client/2007/deployment<br />xmlns:x=“http://schemas.microsoft.com/winfx/2006/xaml”<br />EntryPointAssembly=“UriStyles” EntryPointType=“UriStyles.App”<br />RuntimeVersion=“4.0.50401.0”><br /><Deployment.Parts> <br /> <AssemplyPartxname=“UriStyles”<br /> Source=“UriStyles.dll”/><br /> <AssemplyPartxname=“Systems.Windows.Controls.Data”<br /> Source=“Systems.Windows.Controls.Data.dll”/><br /></Deployment.Parts><br /></Deployment><br />
  9. 9. Application Library Caching<br />Package shared assemblies separately<br />Exploit browser caching<br /><Deployment xmlns=http://schemas.microsoft.com/client/2007/deployment<br />xmlns:x=“http://schemas.microsoft.com/winfx/2006/xaml”<br />EntryPointAssembly=“UriStyles” EntryPointType=“UriStyles.App”<br />RuntimeVersion=“4.0.50401.0”><br /><Deployment.Parts> <br /> <AssemplyPartxname=“UriStyles”<br /> Source=“UriStyles.dll”/><br /></Deployment.Parts><br /><Deployment.ExternalParts><br /> <ExtensionPartSource=“Systems.Windows.Controls.Data.zip”/><br /></Deployment.ExternalParts> <br /></Deployment><br />
  10. 10. Resources: XAP vs ‘Loose’<br />Images, Media, etc. in Silverlight projects end up in XAP:<br />Application is self contained<br />Availability guaranteed once application starts<br />Can add to Web site instead<br />Faster startup<br />Easier to change<br />
  11. 11. Resources and URIs<br />Image ad MediaElement refer to resources<br />Absolute ‘pack:’ URI not supported<br />URI Style<br />Location<br />Img.jpg<br />In Xap (falls back to site, relative to .xap location)<br />/Img.jpg<br />In DLL as embedded resource <br />(alsofalls back to site)<br />/AssemblyName;component/Img.jpg<br />In Xap (falls back to site, relative to .xap location)<br />http://example.com/app/Img.jpg<br />Specified Location<br />
  12. 12. Download UI<br />Define as Xaml<br />Set SplashScreenSource <param><br />Optionally handle onSourceDownloadProgressChanged<br />V1 programming model - JavaScript<br />

×