Md2010 jl-wp7-sl-dev
-
Upload
jose-millas -
Category
Documents
-
view
1.357 -
download
0
description
Transcript of Md2010 jl-wp7-sl-dev
![Page 1: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/1.jpg)
Zagreb, 23. rujna 2010.
![Page 2: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/2.jpg)
Developing WP7 Apps with Silverlight
José Luis LatorreMicrosoft MVP, UX Specialist & Brainsiders CEOhttp://silverlightguy.com
![Page 3: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/3.jpg)
![Page 4: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/4.jpg)
Generalni sponzori:
Glavni sponzori:
Sponzori:
Organizatori:
Medijski sponzori: Strateški partneri:
Službena PR agencija:
Generalni medijski sponzor:
![Page 5: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/5.jpg)
Application Framework details
Common Base Class Library
Collections ComponentModel Configuration
DiagnosticsReflection IO
Security Threading
Runtime Resources Globalization TextLocation Net
ServiceModel Linq
Application Object
Silverlight Presentation and Media
XNA Frameworks for Games
Windows Phone Frameworks
NavigationShapes Markup Media
Controls Drawing IsolatedStorage
AudioMedia GraphicsInput
Drawing GamerServices
Content
PhoneApplicationPage
PushNotification
WebBrowserControl
SensorsPhoneApplicationFra
me
CameraDevice
IntegrationLaunchers &
ChoosersWindows Phone
Controls
![Page 6: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/6.jpg)
What is Silverlight?
Powerful Development Platform
Engaging, Interactive User Experiences
![Page 7: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/7.jpg)
Silverligh capabilities
Inputs
• Keyboard• Mouse• Touch• Ink
Media
• Digital media capture & playback• VC1, WMA, MP3
Data• Language Integrated Query (LINQ)• LINQ to XML• XML• IsolatedStorageBase Class Library (BCL)• Generics• Collections• Cryptography• Threading
Windows Communication Foundation
• REST• RSS/ATOM• SOAP
XAMLUI Core• Vector• Animation• Text• Images
![Page 8: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/8.jpg)
What Silverlight version do we have?
Performance tuning
Input integration
H/W media and sensor integration
OS application model integration
Relaxed sandbox constraints
It is Silverlight 3 but adding:
![Page 9: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/9.jpg)
What makes Silverlight so Special?
MXeXtensible
A LApplication Markup Language
XML
Declarative Markup
<Grid> <TextBlock FontSize="48" Text="Hello world" /></Grid>
![Page 10: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/10.jpg)
What makes Silverlight so Special?
CodeXAML
XAML maps to code
Anything in XAML can be done in code
![Page 11: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/11.jpg)
Silverligth App Model - What’s a XAP?
Tools
Common format for all Windows Phone apps & games
Declarative, manifest-based installation
Integrated into security model of phone
myapp.xap
![Page 12: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/12.jpg)
An overview of a Silverlight app for WP7
![Page 13: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/13.jpg)
Windows Phone application
Application
Frame
Page 3Page 1 Page 2
![Page 14: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/14.jpg)
Silverlight Controls
• Conforming to Metro Design Guidelines.• Consistent Look & Feel.• Familiar to existing Silverlight developers.• They adapt to the current Theme.
![Page 15: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/15.jpg)
OUTPUT
![Page 16: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/16.jpg)
Media
• Media support– H/W decode– MediaStreamSource– PlayReady DRM
• XNA framework sound effect API– Supports polyphony and looping
• MediaElement– Only supports one MediaElement for page– VideoBrush is not supported
![Page 17: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/17.jpg)
XNA for Windows Phone 7
• Using XNA audio capabilities is needed– Using namespace Microsoft.Xna.Framework.Audio– Together with SoundEffect and SoundEffectInstance– Adding the Wav sound file as a content element to the
project.
// AudioSoundEffect soundEffect; string soundName = "kaboom";
// Loading and playing audiosoundEffect = contentManager.Load<SoundEffect>(soundName); soundEffect.Play();
![Page 18: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/18.jpg)
Vibration
• Makes the phone vibrate during a specific duration– Useful for giving a tactile response to the user.– To notify users of an update.
VibrateController vc = VibrateController.Default;vc.Start(TimeSpan.FromSeconds(3));
Microsoft.Devices.Sensors
![Page 19: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/19.jpg)
INPUT
![Page 20: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/20.jpg)
SIP I
• SIP Stands for Software Input Panel.• The TextBox Silverlight control integrates with SIP• SIP supports around 60 different InputScopes:
![Page 21: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/21.jpg)
SIP II
• SIP can be personalized with several versions of the keyboard that the user can select between.
• But the application can also show the optimum keyboard.
• We use InputScope to do that, for example:<TextBox Grid.Row="1" Name="tbNombre" Text=""> <TextBox.InputScope> <InputScope> <InputScopeName NameValue="PersonalGivenName"></InputScopeName> </InputScope> </TextBox.InputScope></TextBox>
![Page 22: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/22.jpg)
A Silverlight “Hello World” for WP7(link to demo)
![Page 23: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/23.jpg)
Accelerometer
• Measures force applied on each axis over time.
+Y
-Y
+X-X
+Z
-Z
![Page 24: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/24.jpg)
Accelerometer I
• Getting data from the Accelerometer1. Add a refference to Microsoft.Devices.Sensors2. Add the corresponding using
3. Declare the variable AccelerometerSensor
4. Get an instance of the AccelerometerSensor
using Microsoft.Devices.Sensors;
AccelerometerSensor accelerometer;
if (accelerometer == null) { sensor accelerometer = new AccelerometerSensor();}
+Y
-Y
+X-X
+Z
-Z
![Page 25: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/25.jpg)
Accelerometer II
• Getting data from the Accelerometer5. Suscribe to the event ReadingChanged
6. Create the event handler
7. Initialize the accelerometer
accelSensor.ReadingChanged += new EventHandler<AccelerometerReadingAsyncEventArgs>(AccelerometerReadingChanged);
public void AccelerometerReadingChanged(object sender, AccelerometerReadingAsyncEventArgs e){ accelReading.X = (float)e.Value.Value.X; accelReading.Y = (float)e.Value.Value.Y; accelReading.Z = (float)e.Value.Value.Z;}
Accelsensor.Start();
+Y
-Y
+X-X
+Z
-Z
![Page 26: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/26.jpg)
OS INTEGRATION
![Page 27: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/27.jpg)
Application Bar & Context Menu
• The «Application Bar» is a control system that provides a quick addition of a tool bar for our WP7 application.
• Apart from the Application Bar, applications can provide additional options like showing one or more menu elements.
Microsoft.Phone.Shell
![Page 28: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/28.jpg)
Application Bar & Context Menu
• By default we have a sample XAML Code for quickly enabling this features on our applications:
<phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> <shell:ApplicationBarIconButton IconUri=“/appbar_button1.png" Text="Button 1"/> <shell:ApplicationBarIconButton IconUri=“/appbar_button2.png" Text="Button 2"/> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem Text="MenuItem 1"/> <shell:ApplicationBarMenuItem Text="MenuItem 2"/> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar></phone:PhoneApplicationPage.ApplicationBar>
![Page 29: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/29.jpg)
Navigation: Frame and Page
• Frame – Is the topmost container control.– PhoneApplicationFrame class.– Contains the page control and sytsem
elements, like System Tray, app bar, etc..
• Page– Fills the entire content region of the
Frame.– Derives from the class
PhoneApplicationPage.– Contains a title.– Can have its own application bar.
![Page 30: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/30.jpg)
Orientation
• In VS2010 we can add a Landscape Page or a Portrait Page.
• The only difference is on the property SupportedOrientation which can be:– Portrait– Landscape– PortraitOrLandscape
• We can’t change the page orientation in code.• But we can react to its changes through the
OrientationChanged event.
![Page 31: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/31.jpg)
Silverlight Toolkit(link to demo)
![Page 32: Md2010 jl-wp7-sl-dev](https://reader035.fdocuments.net/reader035/viewer/2022070312/5538a0444a7959f66c8b4789/html5/thumbnails/32.jpg)