Upload
goodfriday
View
1.163
Download
4
Embed Size (px)
DESCRIPTION
Learn how to extend your Web applications with Silverlight.
Citation preview
Extending the Browser Programming Model with SilverlightStefan SchackowProgram ManagerMicrosoft Corporation
Topics
Working with HTML and JavascriptCloser look at web servicesUsing isolated storageCreating a file upload application using OpenFileDialog
All samples can be downloaded at:• http://mixer1068.mixsandbox.com/
HTML Type HierarchySystem.Windows.Browser
HtmlObject
ScriptableObject
HtmlPage.Window
HtmlDocument HtmlElement
is an
Working with HTML
demo
Working with JavascriptAccessing managed code from Javascript
[Scriptable] enables non-visual use of managed code
Can create managed libraries"Reference" them on the page with a no-op xaml page and code-behind class
Future iterations will remove the need for a xaml type
Working with JavascriptAccessing managed code from Javascript
[Scriptable] managed typesProperties, methods and events accessible from JavascriptDynamically register endpoints using WebApplication
[Scriptable] endpoints hang off the "Content" control property
mySLControl.Content.MyCustomEndpoint.ManagedProperty
Type support in Silverlight AlphaInt, Double, String and ScriptableObjectUse JSON to pass complex types by value
Working with JavascriptAccessing managed code from Javascript
Using a [Scriptable] eventMake sure control is loadedAssign Javascript method to managed event propertyManaged code can then raise event back out to Javascript
Can use custom event argumentsDerive from EventArgsMark the type and one or more properties with [Scriptable]Allows managed code to call "arbitrary" Javascript methods
Using [Scriptable] endpoints
demo
Web servicesSilverlight Alpha works with:
ASP.NET AJAX 1.0 web services (as well as Orcas)
Works with JSON serializable typesPrimitives, string, arrays, DateTime, dictionaries, custom types, and collections of any of these typesCustom type serializers not tested for Alpha
Web servicesCustom slwsdl.exe proxy generator
"/silverlightclient" switch generates a Silverlight specific proxyProxy generator uses a custom System.Web.Services.dll
Custom SoapHttpClientProtocol type used by proxy
"POST" verbContent type set to "application/json"Parameters and return values serialized using JavaScriptSerializerSupports both sync and async models
Web ServicesCalling ASP.NET Application Services
Silverlight can consume JSON based app servicesNeed to manually generate proxy
Take an existing Silverlight web service proxyCopy the type definitionUpdate methods and Url to match app service method signatures
ASP.NET application service Urls are:Profile_JSON_AppService.axdAuthentication_JSON_AppService.axd
Using the profile web service
demo
Isolated Storage
Stream based access to a private file/directory structure
Will have easier accessors in following iterations
Patterned after .NET Framework IsolatedStorage classesRead and write string or binary dataFor Alpha you get an iso-store per Source attribute
contoso.com/foo.xaml and contoso.com/bar.xaml each get a different isostore1MB limit per iso-store
Same iso-store is across browsers
Isolated storage
demo
File upload application
demo
Please fill out your eval
evaluation
© 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.