silverlight 2.0
DESCRIPTION
Silverlight 2.0TRANSCRIPT
Silverlight 2.0Silverlight 2.0
Dave AllenISV Application ArchitectDeveloper and Platform GroupMicrosoft UK
AgendaAgenda
NetworkingWeb ServicesADO.NET Data ServicesWebClientSockets
Isolated StorageFile Open DialogBackground processingHost page interaction
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
DemoDemoSilverlight 2.0 Web Services
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
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
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
DemoDemoSilverlight & ADO.NET Data Services
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
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
DemoDemoIsolated Storage and File Open Dialog
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
DemoDemoBackground processing
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)
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
DemoDemoHost page interaction