silverlight 2.0

17
Silverlight 2.0 Dave Allen ISV Application Architect Developer and Platform Group Microsoft UK

Upload: dave-allen

Post on 31-Oct-2014

473 views

Category:

Technology


1 download

DESCRIPTION

Silverlight 2.0

TRANSCRIPT

Page 1: Silverlight 2.0

Silverlight 2.0Silverlight 2.0

Dave AllenISV Application ArchitectDeveloper and Platform GroupMicrosoft UK

Page 2: Silverlight 2.0

AgendaAgenda

NetworkingWeb ServicesADO.NET Data ServicesWebClientSockets

Isolated StorageFile Open DialogBackground processingHost page interaction

Page 3: Silverlight 2.0

Web ServicesWeb Services

Supports WCF or ASMXbascHttpBinding onlyHTTP or HTTPSGET or POST only200 and 404 only status codes supportedSOAP, POX, JSON, or RSS serializationX-Domain calls require a Policy fileAll communications have to be asynchronous

Page 4: Silverlight 2.0

DemoDemoSilverlight 2.0 Web Services

Page 5: Silverlight 2.0

ADO.NET Data ServicesADO.NET Data Services

Data publishing service using a RESTful interfaceJust uses HTTP

Therefore is able to use existing authentication mechanisms, and other infrastructure components such as caching and proxies

Uniform URL SyntaxEvery piece of information is addressablePredictable and flexible URL syntax

Multiple representationsATOMJSONPOX

Page 6: Silverlight 2.0

ADO.NET Data Services (2)ADO.NET Data Services (2)

Exposes an object model (not a database) over the web

Entity Data Model – ADO.NET DS designed to work with EDMLINQ To SQL model, read-onlyCustom IQueryable<T> provider

Operation semantics, mapping of HTTP verbs for CRUD operations

GET – retrieve resourcePOST – create a resourcePUT – update a resourceDELETE – delete a resource

Page 7: Silverlight 2.0

URL ConventionsURL Conventions

Addressing entities and sets

Presentation options

Entity-set /Product

Single Entity /Product(324)

Member access /Product(324)/Name

Link traversal /ProductSubcategory(2)/Product

Deep access /ProductSubcategory(2)/Product(789)/Name

Raw value access /Product(324)/Name/$value

Sorting /Product?$orderby=Name

Filtering /Product?$filter=Color%20eq%20'Black'

Paging /Product?4top=10$skip=30

Inline expansion /ProductSubcategory?$expand=Product

Page 8: Silverlight 2.0

DemoDemoSilverlight & ADO.NET Data Services

Page 9: Silverlight 2.0

Isolated StorageIsolated Storage

Ability to interact with local file systemVirtual file system supporting single files or a directory of files

Limited size based on quota, default to 1MbPer user, per application or per site/domainCan check quota size or available spaceCan be increased through user prompt

Page 10: Silverlight 2.0

File Open DialogFile Open Dialog

Prompt users for file namesSimilar to OpenFileDialog in WinFormsSupports file filters, *.jpg, etc.Supports multiple file seclectionOnly have access to file name, not the pathFile is read only

Page 11: Silverlight 2.0

DemoDemoIsolated Storage and File Open Dialog

Page 12: Silverlight 2.0

Background processingBackground processing

Keeps the user interface interactiveUseful when operation length is unknown

E.g. any outbound network call

Fits well with Silverlight async programming modelSpawn a new thread using BackgroundWorker

Page 13: Silverlight 2.0

DemoDemoBackground processing

Page 14: Silverlight 2.0

Host page interactionHost page interaction

Two-way communicationCall .NET Silverlight methods from JavaScriptCall JavaScript funcrtions from Silverlight Pass complex structures between them.NET Code needs to be attributed

[ScriptableType] for the class[ScriptableMember] for methods and properties

Scriptable code needs to be registeredHtmlPage.RegisterScriptableObject(id,this)

Page 15: Silverlight 2.0

Host page interaction (2)Host page interaction (2)

Types in System.Windows.BrowserStart with an HtmlPageGrab an HtmlDocument or HtmlWindowWork with HtmlElement instances

Work with DOM and JavaScript typesInvoke methodsGetProperty and SetProperty types

On an HtmlElementGetAttribute and SetAttributeAttachEvent and DetachEvent handlers

Page 16: Silverlight 2.0

DemoDemoHost page interaction

Page 17: Silverlight 2.0