mike taulty techdays 2010 silverlight and windows phone 7 ctp
DESCRIPTION
TRANSCRIPT
Mike Taulty Microsoft UK [email protected] mtaulty.com @mtaulty
Silverlight development for Windows Phone 7 CTP
Silverlight is...?
2007
2008
2009 2010
1: a media player
2: .NET subset for RIA
3: out of browser
4: line of business
Silverlight is...?
a development platform for Windows Phone 7 2007
2008
2009 2010
1: a media player
2: .NET subset for RIA
3: out of browser
4: line of business
Silverlight development on the desktop
C#
Visual Basic
XAML
XAP
XAP
Manifest Assembly Resource
Silverlight Fx/CLR
Silverlight development on Windows Phone 7
C#
Visual Basic
XAML
XAP
Manifest Assembly Resource
.NET Compact Framework/CLR
Windows Phone
Marketplace
demo “Hello World” on the phone
Silverlight functionality on Windows Phone 7
a super-subsetTM of Silverlight 3
Silverlight 3 functionality on the desktop
UI Capabilities
Controls Media Graphics
Composition, Layout, Styling, Resources, Animation, Data Binding, Transformations, Effects
Network
• HTTP(S)
• WCF HTTP(S)
• WCF Data Services
• Sockets
Browser
• HTML Interop
• Javascript Interop
• SL SL Local Messaging
File System
• File Access
• Isolated Storage
Core Assemblies
Silverlight 3 functionality on the desktop
SDK Assemblies
LINQ to XML
Data Annotations
JSON
Controls
• DataGrid
• DescriptionViewer
• Label
• ValidationSummary
• Calendar
• DatePicker
• GridSplitter
• TabControl
• TreeView
• AutoCompleteBox
• PagedCollectionView
WCF
• Data Services
• PollingDuplex
• Syndication
Visual Basic
XML
Browser Interop
WCF ServiceModel
Serialization
Networking
Core UI
•Controls
•Media
•Shapes
•etc
Core Framework
•Collections
• IO
•Diagnostics
•Reflection
•Threading
•etc. XML Serialization
Core Assemblies
Silverlight 3 functionality in the Phone CTP
SDK Assemblies
Controls
• DataGrid
• DescriptionViewer
• Label
• ValidationSummary
• Calendar
• DatePicker
• GridSplitter
• TabControl
• TreeView
• AutoCompleteBox
• PagedCollectionView
WCF
• Data Services
• PollingDuplex
• Syndication
XML
WCF ServiceModel
Serialization
Networking
Core UI
•Controls
•Media
•Shapes
•etc
Core Framework
•Collections
• IO
•Diagnostics
•Reflection
•Threading
•etc.
Browser Interop
Visual Basic
Data Annotations
JSON
LINQ to XML
XML Serialization
Silverlight 3 functionality in the Phone CTP
UI Capabilities Network
• HTTP(S)
• WCF HTTP(S)
File System
• Isolated Storage
Graphics Media Controls
Composition, Layout, Styling, Resources, Animation, Data Binding, Transformations, Effects
Phone Specific
Functionality
about the phone...
application structure – navigation applications
RootVisual
UserControl
Content
Frame
Page
desktop Silverlight
RootVisual
PhoneApplicationFrame
PhoneApplicationPage
phone Silverlight
application lifecycle Not
Running
Startup
Running
Exit
Obscured
Paused
Shell Notification Switch Apps
app may be terminated
controls and themes
standard Silverlight controls re-themed
support for dynamic theming based on user settings
wide margin for ease of touch
demo navigation & control theming
physical information about the phone
screen resolution?
where is the phone?
is the phone moving?
can I alert the user?
screen orientation?
where is the phone?
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Low); // saves power watcher.MovementThreshold = 20; // minimum of 20m - avoids noise, saves power watcher.StatusChanged += (sender, args) => { if (args.Status == GeoPositionStatus.Ready) { // ready... } }; watcher.PositionChanged += (sender, args) => { double altitude = args.Position.Location.Altitude; double latitude = args.Position.Location.Latitude; double longitude = args.Position.Location.Longitude; }; watcher.Start(); // this can throw and we should call Stop()
System.Device.Location.dll
where is that again?
CivicAddressResolver resolver = new CivicAddressResolver(); GeoCoordinate location = GetAlreadyDeterminedLocation(); resolver.ResolveAddressCompleted += (sender, args) => { if (args.Error == null) { string line1 = args.Address.AddressLine1; string line2 = args.Address.AddressLine2; string city = args.Address.City; // etc... } }; resolver.ResolveAddressAsync(location); System.Device.Location.dll
is the phone moving? can I alert the user?
AccelerometerSensor.Default.ReadingChanged += (sender, args) => { if (args.Value.State == SensorState.Ready) { // Deltas X,Y,Z from -1 to +1 – should also check timestamp here if (args.Value.Value.Y >= -0.5) { // Help! I'm falling! Not sure this will help but... VibrateController.Default.Start(new TimeSpan(0, 0, 2)); } } }; // this could throw & we should stop it at some point AccelerometerSensor.Default.Start();
Microsoft.Devices.dll
Microsoft.Devices.Sensors.dll
demo physical aspects of the phone
input capabilities of the phone
hardware buttons ApplicationBar
soft input panel
multi-touch
demo input capabilities
reaching out to existing phone functionality
Launchers “fire and forget” an OS app
Choosers OS offers selection UI for app
WebBrowser control for HTML integration
Choosers
• EmailAddressChooserTask
• PhoneNumberChooserTask
• PhotoChooserTask
Launchers
• BingMapsTask
• CameraCaptureTask
• EmailComposeTask
• MarketplaceLauncher
• MediaPlayerLauncher
• PhoneCallTask
• SaveEmailAddressTask
• SavePhoneNumberTask
• SearchTask
• SMSComposeTask
• WebBrowserTask
demo launchers, choosers, web browser
reaching out to the cloud for notifications
MyApp
Cloud Service
request unique URI
URI
Service (or Client) with push data
URI
transmission of this URI is “out of band”
HTTP POST
reaching out to the cloud for notifications
MyApp
Cloud Service
Service (or Client) with push data
HTTP POST notification types • raw – only to a foreground app • toast – foreground app or as a
toast if app is not foreground • tile – always to the tile & also to
the app if in the foreground
demo push notifications
reaching out to XNA functionality
XNA libraries offer additional functionality e.g. audio capture from phone’s microphone
covered in Paul’s talk next...
resources
developer.windowsphone.com Charles Petzold Preview Book
learningwindowsphone.com Sample Chapters from O’Reilly Book
channel9.msdn.com Windows Phone 7 Training Kit
odata library for Windows Phone 7 CTP silverlight.net
© 2010 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.