TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Windows Phone 7 apps development with Silverlight
1. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Silverlight programming on Microsoft Phone
Radu Poenaru
Microsoft Student Partner
2. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
What we are trying to achieve
• How to create a simple Silverlight app
• Use Blend 4 for Phone for design
http://70gigapixel.cloudapp.net/
3. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
What is Silverlight?
“Silverlight is a powerful development platform for creating
engaging, interactive user experiences for Web, desktop, and
mobile applications when online or offline.”
Microsoft Official Silverlight website
http://www.silverlight.net/
4. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Silverlight
• Very powerful framework
• Same known XAML and C#
• Windows, Mac, Linux and now Phone
• Learning curve is smooth
5. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Silverlight capacities
Inputs
• Keyboard
• Mouse
• Touch
• Ink
Media
• Digital media capture & playback
• VC1, WMA, MP3
Data
• Language Integrated Query (LINQ)
• LINQ to XML
• XML
• IsolatedStorage
Base Class Library (BCL)
• Generics
• Collections
• Cryptography
• Threading
Windows Communication
Foundation
• REST
• RSS/ATOM
• SOAP
XAML
UI Core
• Vector
• Animation
• Text
• Images
6. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
What about Silverlight for Phone
It is a superset of Silverlight 3 having several elements from
Silverlight 4 and many extras:
• Performance tuning
• Input integration
• Hardware media and sensor integration
• OS application model integration
• Relaxed sandbox constraints
7. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
application structure
first, a little history…
8. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Application
default silverlight application
UserControl
ContentContent Content
9. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
silverlight 3 navigation application
UserControl
Frame
Page 3Page 1 Page 2
ApplicationApplication
UserControl
ContentContent Content
10. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Windows Phone application
UserControl
Frame
Page 3Page 1 Page 2
ApplicationApplication
Frame
Page 3Page 1 Page 2
11. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
back key details
• Lets the user to return to previously-viewed screens
• Can go back across applications
• Not used for application-specific behaviour
12. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
a world of constant interruptions
lock
screen
13. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
basic application lifetime
Not
running
Start
Running
Exit
• Obscured
• Paused
14. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
obscured: popup ui from shell
Running
Obscured
Running
Unobscured
Games could
auto-pause
Game could
auto-resume
• Phone call
• Reminder
• Battery low
Not in the
Mix build
15. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
paused: jump to another app
Running
Pause
Suspended
Resume
Assume your
process is killed
Save state
for later use
Load state to continue
where you left off
Not in the
Mix build
User never knows
what happened :-)
• Start Button
• Accept call
• Open toast
16. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Evaluating app performance
•Render Thread FPS: The number of frames per
second that the independent simple animations and
rendering thread is using.
•User Interface Thread FPS: The number of fps that
the primary user interface thread is experiencing
•Texture Memory Usage: A specialized memory
counter indicating the video memory used for storing
application textures.
•Surface Counter: A count of the number of surfaces
that are passed to the graphics chip.
•Intermediate Texture Count: The number of
intermediate textures created for compositing.
•Screen Fill Rate: A metric representing the number
of complete phone screens being painted each and
every frame.
17. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Basics
• XAML – eXtensible Application Markup Language
• XML with custom tags
• Maps to code
• Can contain as children
• resources
• styles
• controls
• supports binding
• Anything that is done in XAML can be done in code
18. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Shapes
• Vector- based
• Easy to scale, keeping the smoothness
• Can be easily imported from Photoshop or Illustrator
• Example(ellipse code):
19. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Brushes
• Determines how objects are painted and outlined
• Solid – filled with just one color
• Gradient – linear or radial with multiple stop points
• Image – shows an image in the brush
• Media – paints with a playing movie
Let‘s see a Demo!
20. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Controls
• Encapsulate functionality
• Requires a x:Name if you plan to call it from the code
• Same properties in XAML as in Code
21. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Events
• Can be created in XAML and Code
• XAML editor helps you create a handler
22. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Layout containers
• Flexible Layout system
• Canvas – fixed position
• StackPanel – „Stacks“ dynamically
• Grid – rows and columns, very flexible
• Can be nested – but beware of performance issues
23. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Demo
• Layout demo
• Attached properties
24. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Transforms
• Alters any element
• Controls
• Text
• Media
• Transforms
• Rotate, Scale, Skew ,Translate, Matrix
• Projections
• Plane, Matrix,
• Apply 3D to a 2D element
25. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Animations
• Animates a property value over the time
• Basic elements in a page
• Contains one or more Storiboards
• Contains one or more Animations
• Contains one or more Keyframes
• Expression Blend is the best tool to do this
Let‘s see some demo!
26. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Styling
• Applies a set of values to a specific target type
• Created in page Resources, application Resources or a
ResourceDictionary
• Requires
• x:Key
• TargetType
• On the element – StaticResource pointing to the x:Key
27. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Binding
• Connects data to UI
• Two types
• Property binding
• List binding
• Value converters – ex take color Red and convert it to hex
representation
• Based on change notification
• Cascades through the hierarchy of controls
28. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Code reuse
• Reuse UI
• User controls
• Custom controls
• Reuse code
• Across projects
• Across platforms – Web, Desktop through OOB, Phone
29. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
References
• Search for Silverlight 3 source:
• Forums, books, podcasts
• http://silverlight.net
• http://www.stackoverflow.com
• Get Started with Silverlight for Windows Phone
http://www.silverlight.net/getstarted/devices/windows-phone/
• Silverlight for Windows Phone forum
http://forums.silverlight.net/forums/63.aspx
• Mix 2010 event http://live.visitmix.com/Sessions
30. Presented by Radu Poenaru at „Windows Phone 7“ Workshop
® Windows Phone®
Comments and sugestions are welcome!
radu.poenaru@studentpartners.de
www.radupoenaru.com
Thank you!
Notes de l'éditeur
My presentation – universitate, msp, interests in MS products,
Questions to know each other
- Programming level, Silverlight, Design
0 Examples for SL 3 apply to the Phone
1
2 the text box has a associated sw keyboard, list have implemented phisyx
3 same video experience, sensors : vibr, location services
4 app is part from experience – same look as Phone
5 security concerns – relax cross-domain policy check
Render Thread FPS: The number of frames per second that the independent simple animations and rendering thread is using. Keeping around 60 will provide a great experience, while a number of 30 fps will begin to show a poor experience to the end user.
Under 30 fps this counter will turn red in post-beta builds.
User Interface Thread FPS: The number of fps that the primary user interface thread is experiencing. Property change notifications, data binding, primary managed code execution, and animations not handled on the render thread use this threads’ resources.
Turns red when the count is at or below 15 fps.
Texture Memory Usage: A specialized memory counter indicating the video memory used for storing application textures.
Surface Counter: A count of the number of surfaces that are passed to the graphics chip.
Intermediate Texture Count: The number of intermediate textures created for compositing.
Screen Fill Rate: A metric representing the number of complete phone screens being painted each and every frame.
Start the dev of sample application – text block in XAML and code
Importable from designers‘ Photoshop
No demo yet
Demo with Ellipse
VS can create the events for you
Or you can create them by hand
Default event handler for Button – Click event
Or by double clicking
Grid – layout system, not semantic informational display
Attached properties
A ball doesn‘t now its position, but the parent can provide it.
Canvas – not so flexible, phone can be rotated
Stack panel
Grid – rows : auto or * or pixels
Ball pulsing demo app
- animation in Blend
- call it from code