don gillett principal architect microsoft corporation bb41

23
Live Services: What I Learned Building My First Mesh Application Don Gillett Principal Architect Microsoft Corporation BB41

Upload: owen-whitehead

Post on 25-Dec-2015

220 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Don Gillett Principal Architect Microsoft Corporation BB41

Live Services: What I Learned Building My First Mesh Application

Don GillettPrincipal ArchitectMicrosoft Corporation

BB41

Page 2: Don Gillett Principal Architect Microsoft Corporation BB41

Mesh Application OverviewJotDemoKey Takeaways and TipsCode walkthroughQ & A

Agenda

Page 3: Don Gillett Principal Architect Microsoft Corporation BB41

Azure™ Services Platform

Azure™ Services Platform

Page 4: Don Gillett Principal Architect Microsoft Corporation BB41

Mesh ApplicationsSynchronized access to your shared data

desktop

phoneserver

Page 5: Don Gillett Principal Architect Microsoft Corporation BB41

Simple note taking and list creation Notes and lists can be shared between people

and across devices. Developed Jot as both a Mesh Application and

a ‘Mesh Enabled’ Desktop Application Key Scenarios

Shopping Lists Weekend To-do Lists Gift List Expense List “Digital Junk Drawer”

Jot

Page 6: Don Gillett Principal Architect Microsoft Corporation BB41

Jot

demo

Page 7: Don Gillett Principal Architect Microsoft Corporation BB41

Live Framework delivers another great component for .NET developers… it just fits in and getting started is simple.

A synchronized data store is at the heart of Mesh and it’s easy to utilize.

Mesh Applications work great with Silverlight. Mesh + Silverlight makes an excellent rapid development platform.

Compile your projects for both Silverlight and the full .NET runtime (desktop apps and services).

Best part... what I didn't have to do. User management, authentication, invites, contacts, permissions, ...

Key Takeaways

Page 8: Don Gillett Principal Architect Microsoft Corporation BB41

Getting Started With The Live Framework Librariesusing Microsoft.LiveFX.Client;

Mesh mesh = ConnectToMesh();

foreach (MeshObject meshObject in mesh.MeshObjects.Entries){

Console.WriteLine("MeshObject:\t{0} (type {1})",meshObject.Resource.Title,meshObject.Resource.Type);

foreach (DataFeed dataFeed in meshObject.DataFeeds.Entries){

Console.WriteLine(" DataFeed:\t{0} (type {1})",dataFeed.Resource.Title,dataFeed.Resource.Type);

foreach (DataEntry dataEntry in dataFeed.DataEntries.Entries)

{Console.WriteLine(" DataEntry:\t{0} (type {1})",dataEntry.Resource.Title,dataEntry.Resource.Type);

}}

}

Page 9: Don Gillett Principal Architect Microsoft Corporation BB41

MeshObjects, DataFeeds, DataEntries, and Enclosures make up the Mesh storage hierarchy…

MeshObjects are our top level containers MeshObjects represent the unit you want

to share. Live Folders creates one MeshObject for each

top level Live Folder that is created. Jot also creates one MeshObject for each Jot list.

Storing Data In The MeshCreating a 'Storage Model'

Page 10: Don Gillett Principal Architect Microsoft Corporation BB41

MeshObjects can contain 1 or more DataFeeds. DataFeeds represents a collection of data you want to

access and group together DataEntries

Represents your smallest storage units and can contain small chunks of application data directly within the DataFeed

Enclosures Enclosures are used when your chunks of data get

too big. They are stored in the Mesh and referenced from

a DataEntry.

Storing data in the Mesh Creating a 'Storage Model' (continued)

Page 11: Don Gillett Principal Architect Microsoft Corporation BB41

Live Framework Resource Model

Devices

Media Resources

Data Entry

Members Mappings Data Feeds News Subscription

Applications News Notification Queue

Mesh Objects

Scripts ProfilesMesh Contacts

LOEEnd-Point

Data Entry

Page 12: Don Gillett Principal Architect Microsoft Corporation BB41

Evolve from flat serialization or database storage to a merge-able storage schema using DataEntries

Step 0 - We’ll start with an application that knows how to persist to a database or flat file.

Step 1 - Reading and writing DataEntries from a DataFeed rather than directly serializing or loading from a database.

Step 2 – Utilize FeedSync. With FeedSync integration we can easily batch our changes, as well as easily accept changes made from other devices and users.

Storing Data In The MeshThe Code

Page 13: Don Gillett Principal Architect Microsoft Corporation BB41

Synchronization of data makes a good system of change notification all that more important. INotifyCollectionChanged and

INotifyPropertyChanged facilitate Silverlight and WPF data binding

ObservableCollection<T> implements INotifyCollectionChanged

One major gotcha is that notifications going to UI need to happen on the UI thread.

Code WalkthroughSilverlight and WPF data binding

(Try these search terms some good articles about getting change notifications to the UI thread for Silverlight and WPF.)

Page 14: Don Gillett Principal Architect Microsoft Corporation BB41

Mow the grassBuy giftsCall home

Code Walkthrough Object Model

Checklist

ChecklistItem

ChecklistItem

ChecklistItem

ChecklistItemData

ChecklistItemData

ChecklistItemData

Page 15: Don Gillett Principal Architect Microsoft Corporation BB41

Checklist Application

code walkthrough

Page 16: Don Gillett Principal Architect Microsoft Corporation BB41

Membership based on Windows Live ID Authentication Sharing Permissions and Invites Contacts News Feeds Application Distribution …

The Things Live Framework Gives Me Beyond Storage

Page 17: Don Gillett Principal Architect Microsoft Corporation BB41

Cross Development Between Silverlight And .NET (Desktop And Services)

Page 18: Don Gillett Principal Architect Microsoft Corporation BB41

Usefull (Invaluable) Tools

Fiddler 2Download from http://fiddlertool.com

Resource Model BrowserComes with the Live Framework SDK

Page 19: Don Gillett Principal Architect Microsoft Corporation BB41

Fiddler TipHow to substitute/debug any file on the web without uploading it

static function OnBeforeResponse(oSession: Session){

if (oSession.uriContains("myapp.xap")) {

oSession["ui-color"]="red";oSession["ui-italic"]="true";oSession.LoadResponseFromFile(

"C:\\myapp\\bin\\debug\\myapp.xap");oSession.oResponse.headers.Add("Vary", "*");

}…

Page 20: Don Gillett Principal Architect Microsoft Corporation BB41

Evals & Recordings

Please fill

out your

evaluation for

this session at:

This session will be available as a recording at:

www.microsoftpdc.com

Page 21: Don Gillett Principal Architect Microsoft Corporation BB41

Please use the microphones provided

Q&A

Page 22: Don Gillett Principal Architect Microsoft Corporation BB41

© 2008 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.

Page 23: Don Gillett Principal Architect Microsoft Corporation BB41