Presentation is loading. Please wait.

Presentation is loading. Please wait.

Charles Petzold www.charlespetzold.com Silverlight for Windows Phone.

Similar presentations


Presentation on theme: "Charles Petzold www.charlespetzold.com Silverlight for Windows Phone."— Presentation transcript:

1 Charles Petzold www.charlespetzold.com Silverlight for Windows Phone

2 Agenda Windows Phone 7 Silverlight for Windows Phone Your first phone application Deploying to a device Page orientation Screen layout Device information

3 Meet or exceed a common hardware specification –Minimum 1 GHz ARM v7 CPU and DirectX9 GPU –Minimum 256 MB RAM and 8 GB flash storage –480 x 800 screen (480 x 320 coming later) –Capacitive 4-point multi-touch screen –Minimum 5-megapixel camera –Location (Assisted-GPS), accelerometer, compass, light sensor, and proximity sensor –Connectivity support via cellular networks and WiFi Available from Samsung, HTC, and other OEMs Windows Phones

4 Operating system for Windows phones –Clean break from the past (Windows Mobile) –Released in U.S. on November 8, 2010 "Metro" user interface –Crisp and sexy (icon grids are boring) –Start screen populated with tiles –Hubs that aggregate content (Pictures, Games, etc.) Built-in browser based on IE7 and IE8 Apps written in Silverlight or XNA Windows Phone 7

5 UI Design and Interaction Guide for WP7 –http://go.microsoft.com/fwlink/?LinkID=183218 WP7 Application Certification Requirements –http://go.microsoft.com/?linkid=9730558 Documents You Must Have

6 Primary development platform for WP7 phones Based on Silverlight 3, but with some features of 4 Adds many phone-specific features –Page orientation (portrait or landscape) –Richer touch APIs (Manipulation events) –Sensor and location APIs –Device APIs (e.g., camera) –Launchers and choosers and more Based on.NET Compact Framework 3.7 Silverlight for Windows Phone

7 Windows Phone Developer Tools –Visual Studio 2010 Express for Windows Phone –Expression Blend for Windows Phone –Windows Phone Emulator –XNA Game Studio –http://www.microsoft.com/downloads/en/details.aspx?F amilyID=04704acf-a63a-4f97-952c-8b51b34b00ce Silverlight for Windows Phone Toolkit –http://silverlight.codeplex.com/releases/view/55034 Phone Developer Tools

8 Runs phone apps in a VM Supports multi-touch on PCs with multi-touch screens and OSes that support multi-touch For best performance, enable hardware-assisted virtualization in your BIOS –http://www.microsoft.com/windows/virtual-pc/support/configure-bios.aspx For GPU emulation, run dxdiag.exe and make sure DDI version >= 10 and WDDM version >= 1.1 –http://www.andybeaulieu.com/Default.aspx?EntryID=196&tabid=67 Windows Phone Emulator

9 demo Your First Windows Phone Application

10 Visual Studio supports deploying to the emulator or to a device (phone) To deploy to a device, you must: –Register and obtain a developer account http://create.msdn.com/en-us/home/membership –Unlock the device with the Developer Registration Tool http://msdn.microsoft.com/en-us/library/ff769508(v=vs.92).aspx –Download and install the Zune client http://www.zune.net/en-US/products/software Debugger works with code running on a device! Deploying to a Device

11 Start the Zune client before deploying to device Media APIs not available while client is running Zune Client

12 First shipped in October 2010 tools update Enables apps running on phones connected to PCs to access media APIs WPConnect

13 demo Testing on a Device

14 Display can rotate when orientation changes PhoneApplicationPage.SupportedOrientations controls behavior when orientation changes –Portrait – Display does not rotate –Landscape – Display does not rotate –PortraitOrLandscape – Display rotates automatically PhoneApplicationPage.OrientationChanged events fire when orientation changes –If SupportedOrientations = "PortraitOrLandscape" Page Orientation

15 Preventing the Page from Rotating // In MainPage.xaml SupportedOrientations="Portrait"

16 Rotating the Page // In MainPage.xaml SupportedOrientations="PortraitOrLandscape"

17 Customizing the Rotated Page // In the page constructor this.OrientationChanged += new EventHandler (OnOrientationChanged); private void OnOrientationChanged(object sender, OrientationChangedEventArgs e) { if ((e.Orientation & PageOrientation.Landscape) != 0) { // TODO: Adjust the page for landscape mode } else // Portrait { // TODO: Adjust the page for portrait mode }

18 demo Page Orientation

19 Screen Layout Screen layout includes optional system tray and application bar System tray 32 pixels high in portrait mode 72 pixels high in landscape mode Application bar 72 pixels high in portrait mode 72 pixels high in landscape mode

20 Hiding the System Tray // In MainPage.xaml <phone:PhoneApplicationPage x:Class="PhoneDemo.MainPage"... FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="False"> Hide the system tray

21 Getting the Absolute Screen Size double width = Application.Current.Host.Content.ActualWidth; double height = Application.Current.Host.Content.ActualHeight;

22 Getting the Usable Screen Size double width = this.ActualWidth; double height = this.ActualHeight;

23 DeviceExtendedProperties class provides information about host device Retrieve dictionary-type values with GetValue Getting Device Information

24 DeviceExtendedProperties ValueDescriptionType DeviceManufacturer Device manufacturer (e.g. SAMSUNG)string DeviceName Device name (e.g., SGH-i917)string DeviceUniqueId Device ID (e.g., 29-49-7B-05-D3-FA…)byte[] DeviceFirmwareVersion Firmware version (e.g., 2013.10.10.1)string DeviceHardwareVersion Hardware version (e.g., 3.1.0.7)string DeviceTotalMemory Total memory (bytes)long ApplicationCurrent- MemoryUsage Memory currently allocated (bytes)long ApplicationPeak- MemoryUsage Peak memory allocated (bytes)long

25 Getting Model Information string manufacturer = DeviceExtendedProperties.GetValue ("DeviceManufacturer").ToString(); string name = DeviceExtendedProperties.GetValue ("DeviceName").ToString(); string id = BitConverter.ToString((byte[]) DeviceExtendedProperties.GetValue("DeviceUniqueId"));

26 Getting Memory Information string total = ((long)DeviceExtendedProperties.GetValue ("DeviceTotalMemory")).ToString("N0") + " bytes"; string current = ((long)DeviceExtendedProperties.GetValue ("ApplicationCurrentMemoryUsage")).ToString("N0") + " bytes"; string peak = ((long)DeviceExtendedProperties.GetValue ("ApplicationPeakMemoryUsage")).ToString("N0") + " bytes";

27 Charles Petzold www.charlespetzold.com Questions?


Download ppt "Charles Petzold www.charlespetzold.com Silverlight for Windows Phone."

Similar presentations


Ads by Google