490 likes | 634 Views
March 15, 2010. Ashish Shetty Program Manager | Microsoft Silverlight http://nerddawg.blogspot.com. Stepping Outside the Browser with Silverlight 4 . Why step outside the browser?. Give Your Apps a New Home. On Mac, Windows and elsewhere. More Options. Build immersive experiences.
E N D
March 15, 2010 Ashish Shetty Program Manager | Microsoft Silverlight http://nerddawg.blogspot.com Stepping Outside the Browser with Silverlight 4
Give Your Apps a New Home On Mac, Windows and elsewhere
More Options Build immersive experiences
Harness Local Data “Put the computation near the data” - Jim Gray
Stepping outside the browser In Silverlight 3
Rigid Security Sandbox Smart defaults Run same app in and out of browser
Friction-free App Deployments With built-in updating
Network Connectivity APIs Your app works on and off the grid
Higher Local Storage Quotas 25MB Isolated Storage default gives you more room to stretch
Basic Out of Browser App code | demo
Stepping outside the browser In Silverlight 4
Beyond the Browser in Silverlight 4 • Web Browser hosting • Window customization • Toast notifications • Offline DRM media playback • Silent install/uninstall support • Install-free “emulation mode” run • Trusted Apps New & Improved
Web Browser Hosting Silverlight $ Web content
WebBrowser Control • <WebBrowser Source="http://any.site" • Height="…" • Width="…"ScriptNotify="…" • /> • Navigate to URL • Get/Set markup as a string • 2-way interop • Supports browser plug-ins and doc objects • Flash, PDF, Visio etc. • “Windowed” hosting
WebBrowser Brush • <WebBrowser Source="http://any.site" • x:Name="foo" • /> • … • <Rectangle> • <Rectangle.Fill> • <WebBrowserBrushSourceName="foo" • Opacity="0.5" • Stretch="…" /> • </Rectangle.Fill> • </Rectangle> • Enables layering of HTML and Silverlight • Opacity, rotation, effects, stretch/skew • HTML content is not-interactive
Window Customization top, left • Startup location • Dimensions of client area • TopMost • Activate() and IsActive • Close() and Cancellable Closing event height width topmost
“Toast” Notifications • Rectangular • 400 x 100 px max • 30 secs max • Can activate main window x You have 325 new voicemails Listen
“Toast” Notifications NotificationWindow toast = new NotificationWindow(); toast.Content = new ToastContent(); toast.Content.MouseLeftButtonUp += (s, arg) => { Application.Current.MainWindow.Activate(); }; toast.Show(4000);
Window Settings and “Toast” Notifications code | demo
Silent install of apps • Enterprise installs via scripts, installers or executables sllauncher.exe /install:"somePath\myApp.xap" /origin:"http://any.site.com/myApp.xap" /shortcut:desktop+startmenu /overwrite sllauncher.exe /uninstall /origin:"http://any.site.com/myApp.xap" Platform Specific Usage
Launch app without installing • For developer tools; Or if deploying via CD, DVD, USB media sllauncher.exe /emulate:"somePath\myApp.xap" /origin:"http://any.site.com/myApp.xap" /overwrite Platform Specific Usage
Silverlight Trusted Applications Because not all apps can play in the sandbox File system access Device access Interop with external components Access to features not yet in Silverlight
Trusted ApplicationSome things to remember • No trusted operations possible within the browser • Per-user app, not system-wide • Runs with standard user privileges, not admin • Great defense in depth with UAC on [recommended!] • No consent No trust No install • Group Policy hooks to disable install, activation • With great power comes great responsibility • Set expectations with consumer user • Sign your XAPs!
Beyond the Browser in Silverlight 4Features for Trusted Apps Only… • Removed Sandbox speed bumps • File System Access • Native Integration • Window Chrome customizations • Digital Signing of XAPs New & Improved
Removed Speed Bumps Cross-domain policy in networking sockets http &
Removed Speed Bumps Socket port range restrictions 4502 - 4534
Removed Speed Bumps Restrictions on full File path * OpenFileDialog SaveFileDialog &
Removed Speed Bumps User initiation requirements
Removed Speed Bumps Restrictions on Keyboard input in FullScreen mode Yes, really
File System Access • Access to “My Files” • Documents • Pictures • Music • Videos • Types from System.IO • File • Directory • Environment • Etc.
File System Access Creating a new video file // defensive code == portable code if(Application.Current.HasElevatedPermission) { // look ma, no path hard-coding! // this code works on Mac, Windows, everywhere stringpath = Environment.GetFolderPath( Environment.SpecialFolder.MyVideos); stringmediaFile = Path.Combine(path, "Foo.mp4"); if(!File.Exists(mediaFile) { using(FileStreamfs = File.Create(mediaFile)) { //... } } }
Native Integration • … via Automation of external / system components • // defensive code == portable code • if (AutomationFactory.IsAvailable) { • dynamicxl = AutomationFactory.CreateObject("Excel.Application"); • xl.Visible = true; • xl.Workbooks.Add(); • //... • } Platform Specific Code coming soon
Common Automation Services • Office interoperability • WMI (system information, file watching) • ADO DB • Sensors (GPS) • Speech • Etc. Consult Automation servers’ documentation
Trusted Application code | demo
Digital Signing of XAPs • Applies to Trusted Apps only • Install and Update –time enforcements • Use Code Signing certificates
Digital Signing of XAPs For consumers For app authors Better install-time UX App Icon Publisher name Seamless updates • Reassurance on authenticity and integrity of app • Clear publisher and provenance info on app Highly Recommended
How to Digitally Sign XAPs Project Properties pane Command Prompt signtool.exe sign /v /f nameOfCert.pfx /p "<password>" nameOfApp.xap or
With Silverlight… • Build sticky desktop experiences • More features outside the browser • Harness local data and provide immersive, latency-free experiences • …by putting the computation near the data
Thank You! With a little help from our friends
Credits • Matryoshka doll • http://www.flickr.com/photos/frangipani_photograph/3066995907 • Image courtesy of Frangipani Photograph • License: Creative Commons 2.0 (by-nc-nd) • Lock • http://www.flickr.com/photos/amagill/235453953/sizes/s/ • Image courtesy ofAmagill • License: Creative Commons 2.0 (by) • Phone connected to laptop • http://www.flickr.com/photos/re-ality/41676755/sizes/o/ • Image courtesy of re-ality • License: Creative Commons 2.0 (by) • Sandbox • http://www.flickr.com/photos/fenris/33546752/sizes/m/ • Image courtesy of abkfenris • License: Creative Commons 2.0 (by) • Children on slide • http://www.flickr.com/photos/sixthworld/3964450408/sizes/m/ • Image courtesy of Thomas Ott • License: Creative Commons 2.0 (by) • Cat stretch • http://www.flickr.com/photos/edvvc/483090647/sizes/m/ • Image courtesy of edvvc • License: Creative Commons 2.0 (by) • U.S. Declaration of Independence image is a public domain artifact from the National Archives • http://www.archives.gov/exhibits/charters/declaration.html • All logos and icons are trademarks of their respective owners, and are used here only to represent those products or brands
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.