Out of Browser with Silverlight 3

March 18, 2009 14:46 by docbliny 

One big surprise for me was that out of browser support made it into version 3. While it is nowhere near as comprehensive as Adobe Air, its main advantages are that users don’t need a separate runtime download and for developers the programming model is pretty much the same for in and out of browser.

View the session.

 

Installation

Installing a Silverlight application is easy for the user, and making an application available is easy for the developer.

  • Shortcuts can be placed on desktop and Start-menu.
  • No Control Panel Add/Remove Programs item added (listening to feedback).
  • Right-click: Remove this application.
  • Multiple icon sizes can be provided. Must be PNGs (transparency supported).
    • Install dialog
    • Taskbar
    • Window
  • Applications can be “previewed” in the browser before installation since the application is the same in both the browser and out.

Detaching APIs

“Detaching” is the term of moving (installing) a Silverlight application from browser onto the desktop.

  • Manifest
    • Name, Title, and Description
    • Application icons
  • APIs on Application
    • Detach method (must be called from a user interaction)
    • ExecutionState property
    • ExecutionStartChanged event
    • RunningOffline property

Updating Applications

  • Optimized for “instant on”. No check for “new version” is done when the application starts.
  • Silverlight downloads update in the background.
  • Next application launch runs the new version.
  • Event raised when an update has been downloaded. This lets you prompt the user to restart the application if necessary.

Network Availability

  • Network access information is key for out of browser applications
  • Silverlight adds functionality
    • IP address changed event
    • Network availability property
      • Any net interface, connected, not looped back
  • Best practice is to “ping” server by attempting to download a small file when state changes and a valid IP address exists. There maybe cases where the network is “available”, but limited to the local network (automatically generated private IP address).

Saving Data Locally

  • OoB Isolated Storage limit is increased to 25MB
    • Limit is increased when the application is detached
  • SaveFileDialog
    • Allows you to set file types (filter)
    • Application gets access to a Stream, but not the path

Details

  • HTML DOM Bridge is not available
  • Shortcuts point to a small Silverlight host application that contains a browser instance
  • LocalLow\Microsoft\Offline\[ApplicationName]
  • LocalLow\Microsoft\is\[random]\[random]\[etc…]
  • Bundles are used on Macs

Debugging

  • Use MessageBox for startup with Application_UnhandledException
  • Use Attach to Process on slhost.exe in Visual Studio. Will be improved post beta.

Differences vs. In Browser

  • Additional key access (Function keys for example)
  • No HTML DOM Bridge
    • No mouse wheel
    • No XmlHttp
  • Currently no HTML interop or rendering.
  • Out of browser will currently always have operating system window chrome.

Best Practices

  • (See above for network availability testing)
  • Download local data in the OoB instance after the application has been detached. 
    • Check RunningOffline to see if you’re out of browser
  • Don’t fire off more than one HWR at a time.
  • Keep all your code in the XAP
    • Silverlight versions for you making updates easy to manage
    • Assets can go outside
  • If your data model changes, require a restart.
  • Show UI for major updates so user knows things have changed.

Links

Mike Harsh’s Slidentity Silverlight “PowerPoint” application.

MSDN pre-release documentation.


Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading