The document discusses several topics related to developing applications using Silverlight, including:
1. Using scriptable objects to enable non-visual use of managed code and dynamically register endpoints from JavaScript.
2. Consuming web services from Silverlight, including support for JSON serialization and generating Silverlight-specific proxies.
3. Providing isolated storage in Silverlight to allow a private file/directory structure with read and write access to string or binary data.
3. 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/
4. ScriptableObject
is an
HtmlObject HtmlPage.Window
HtmlDocument HtmlElement
5.
6. [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
7. [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
8. 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
9.
10. 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
11. 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
12. 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
13.
14. 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