Extending the Browser Programming Model with Silverlight


Published on

Learn how to extend your Web applications with Silverlight.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Extending the Browser Programming Model with Silverlight

  1. 1. Stefan Schackow Program Manager Microsoft Corporation
  2. 2. Working with HTML and Javascript Closer look at web services Using isolated storage Creating a file upload application using OpenFileDialog All samples can be downloaded at: • http://mixer1068.mixsandbox.com/
  3. 3. ScriptableObject is an HtmlObject HtmlPage.Window HtmlDocument HtmlElement
  4. 4. [Scriptable] enables non-visual use of managed code Can create managed libraries quot;Referencequot; them on the page with a no-op xaml page and code-behind class Future iterations will remove the need for a xaml type
  5. 5. [Scriptable] managed types Properties, methods and events accessible from Javascript Dynamically register endpoints using WebApplication [Scriptable] endpoints hang off the quot;Contentquot; control property mySLControl.Content.MyCustomEndpoint.ManagedProperty Type support in Silverlight Alpha Int, Double, String and ScriptableObject Use JSON to pass complex types by value
  6. 6. Using a [Scriptable] event Make sure control is loaded Assign Javascript method to managed event property Managed code can then raise event back out to Javascript Can use custom event arguments Derive from EventArgs Mark the type and one or more properties with [Scriptable] Allows managed code to call quot;arbitraryquot; Javascript methods
  7. 7. Silverlight Alpha works with: ASP.NET AJAX 1.0 web services (as well as Orcas) Works with JSON serializable types Primitives, string, arrays, DateTime, dictionaries, custom types, and collections of any of these types Custom type serializers not tested for Alpha
  8. 8. Custom slwsdl.exe proxy generator quot;/silverlightclientquot; switch generates a Silverlight specific proxy Proxy generator uses a custom System.Web.Services.dll Custom SoapHttpClientProtocol type used by proxy quot;POSTquot; verb Content type set to quot;application/jsonquot; Parameters and return values serialized using JavaScriptSerializer Supports both sync and async models
  9. 9. Silverlight can consume JSON based app services Need to manually generate proxy Take an existing Silverlight web service proxy Copy the type definition Update methods and Url to match app service method signatures ASP.NET application service Urls are: Profile_JSON_AppService.axd Authentication_JSON_AppService.axd
  10. 10. Stream based access to a private file/directory structure Will have easier accessors in following iterations Patterned after .NET Framework IsolatedStorage classes Read and write string or binary data For Alpha you get an iso-store per Source attribute contoso.com/foo.xaml and contoso.com/bar.xaml each get a different isostore 1MB limit per iso-store Same iso-store is across browsers
  11. 11. © 2007 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.