SlideShare uma empresa Scribd logo
1 de 62
Highlights of What’s
New in Windows
Phone Mango
Glen Gordon
Developer Evangelist, Microsoft
http://glengordon.name
Topics
   Fast Application Switching
   Background Agents
   Live Tiles
   XNA/Silverlight integration




    Windows Phone
Demo

Demo 1:
Fast Application Switching
Application Lifecycle - Dormant App Resume
                                Fast

                                      running
State preserved!
e.IsApplicationInstancePreserved                                  Save State!
== true



                          activated             deactivated




                                      dormant   Phone resources detached
                                                Threads & timers suspended

     Windows Phone
Application Lifecycle - Tombstoned ..
                                Resuming
                                                                     .
Restore state!
e.IsApplicationInstancePreserved
                                             running
== false




                                 activated             deactivated




 Tombstone          Tombstoned               dormant   Phone resources detached
 the oldest                                            Threads & timers suspended
 app
    Windows Phone
Methods & Events




 Windows Phone     6
Finding the Resume type
    private void Application_Activated(object sender, ActivatedEventArgs e)
    {
        if (e.IsApplicationInstancePreserved)
        {
             // Dormant - objects in memory intact
        }
        else
        {
             // Tombstoned - need to reload
        }
    }

   The Activation handler can test a flag to determine the type of resume taking
    place

     Windows Phone
Deactivation Resource Management
                           MediaPlayer.Pause
                           MediaElement.Pause
                       SoundEffectInstance.Pause
                        VibrateController.Stop
                          PhotoCamera.Dispose
                           Save page/global state

                 XNA Audio      Paused
                 Sensors        Notifications suppressed
                 Networking     Cancelled
                 Sockets        Disconnected
                 MediaElement   Disconnected
                 Camera         Disposed

 Windows Phone
Activation Resource Management

                 MediaElement.Source/Position/Play
                 Socket.ConnectAsync
                 new PhotoCamera/VideoCamera

                 Restore app state if tombstoned

                 XNA Audio      Resumed
                 Sensors        Notifications resumed
                 Networking     Completed with Cancellation
                 Sockets        -
                 MediaElement   -
                 Camera         -
 Windows Phone
Isolated Storage vs State Storage
   Isolated storage is so called because the data for an application is isolated from
    all other applications
        It can be used as filestore where an application can store folders and files
        It is slow to access, since it is based on NVRAM technology
        It can also be used to store name/value pairs, e.g. program settings
   State storage is so called because it is used to hold the state of an application
        It can be used to store name/value pairs which are held in memory for
          dormant or tombstoned applications
        It provides very quick access to data

    Windows Phone                                      10
Captain’s Log


Demo
•   With No Storage
•   With Storage
•   Fully Working
Background Tasks
Multitasking Capabilities

   Background Agents
      Periodic
      Resource Intensive
   Background Transfer Service
   Alarms and Reminders
   Background Audio

    Windows Phone                 14
Background Agents
        Agents
             Periodic
             Resource Intensive
        An app may have up to one of each
        Initialized in foreground, run in background
             Persisted across reboots
        User control through Settings
             System maximum of 18 periodic agent
        Agent runs for up to 14 days (can be renewed)


15       Windows Phone
Generic Agent Types
Periodic Agents      Resource Intensive
 Occurrence         Agents
   Every 30 min      Occurrence
 Duration              External power
   ~15 seconds         Non-cell network
 Constraints         Duration
   <= 6 MB Memory      10 minutes
   <=10% CPU         Constraints
                        <= 6 MB Memory
16
Background Agent Functionality
                         Allowed              Restricted
         Tiles
         Toast                       Display UI
         Location                    XNA libraries
         Network                     Microphone and Camera
         R/W ISO store               Sensors
         Sockets                     Play audio
                                       (may only use background audio APIs)
         Most framework APIs


17       Windows Phone
Demo

Demo1: Captain’s Location Log
Debugging a Background Task
    #if DEBUG_AGENT
     ScheduledActionService.LaunchForTest(taskName, TimeSpan.FromSeconds(60));
    #endif


   It would be annoying if we had to wait 30 minutes to get code in the agent
    running so we could debug it
   When we are debugging we can force service to launch itself
   Such code can be conditionally compiled and removed before the production
    version is built




     Windows Phone                                 19
Debugging the Agent Code
   When you use the Back button or Start on the phone to interrupt an application
    with an active Background Task ,Visual Studio does not stop running
   It remains attached to the application
   You can then put breakpoints into the background task application and debug
    them as you would any other program
   You can single step, view the contents of variables and even change them
    using the Immediate Window
   This is also true if you are working on a device rather than the emulator
   The same techniques work on ResourceIntensiveAgents

    Windows Phone                                    20
Demo

Demo2: Debugging Tasks
File Transfer Tasks
   It is also possible to create a background task to transfer files to and from your
    application’s isolated storage
   The transfers will continue to work even when the application is not running
   An application can monitor the state of the downloads and display their status
   Files can be fetched from HTTP or HTTPs hosts
         At the moment FTP is not supported
   The system maintains a queue of active transfers and services each one in
    turn
   Applications can query the state of active transfers

    Windows Phone                                       22
Background Transfer Policies
   There are a set of policies that control transfer behavior
       Maximum Upload file size: 5Mb
       Maximum Download file size over cellular (mobile phone) data: 20Mb
       Maximum Download file size over WiFi: 100Mb
   These can be modified by setting the value of TransferPreferences on a
    particular transfer




    Windows Phone                                23
Transfer Management
   An application can find out how many file transfers it has active
        It will have to do this when it is restarted, as file transfers will continue even
         when the application is not running
   It can then perform transfer management as required
   There is a good example of transfer list management on MSDN:

                    http://msdn.microsoft.com/en-us/library/hh202953.aspx



    Windows Phone
Demo

Demo3: Picture Fetch
Scheduled Notifications

   Time-based, on-phone notifications
   Supports Alerts & Reminders
   Persist across reboots
   Adheres to user settings
   Consistent with phone UX


    Windows Phone                    26
Alarms vs Reminders?
Alarms                     Reminde
                           rs



 •   Modal                 •   Rich information
 •   Snooze and Dismiss    •   Integrates with other reminders
 •   Sound customization   •   Snooze and Dismiss
 •   No app invocation     •   Launch app
 •   No stacking           •   Follows the phones global settings
27
Creating a Reminder
    using Microsoft.Phone.Scheduler;
    ...
    eggReminder = new Reminder("Egg Timer");

    eggReminder.BeginTime = DateTime.Now + new TimeSpan(0, eggTime, 0);
    eggReminder.Content = "Egg Ready";
    eggReminder.RecurrenceType = RecurrenceInterval.None;
    eggReminder.NavigationUri = new Uri("/EggReadyPage.xaml", UriKind.Relative);

    ScheduledActionService.Add(eggReminder);

   This code creates a reminder and adds it as a scheduled service
   The value eggTime holds the length of the delay
   This code also sets the url of the page in the application
     Windows Phone                                  28
Reminder Housekeeping
    Reminder eggReminder = ScheduledActionService.Find("Egg Timer") as Reminder;

    if ( eggReminder != null )
    {
        ScheduledActionService.Remove("Egg Timer");
    }

   Reminders are identified by name
   This code finds the “Egg Timer” reminder and then removes it from the
    scheduler




     Windows Phone                                    29
Demo

Demo4: Egg Timer
Audio Playback Agents
   It is also possible to create an
    Audio Playback Agent that
    will manage an application
    controlled playlist
   The mechanism is the same
    as for other background
    tasks
   The audio can be streamed
    or held in the application
    isolated storage



    Windows Phone                      31
Background Audio
   Playback
       App provides URL or stream to Zune
       Audio continues to play even if app is closed
       App is notified of file or buffer near completion
   Phone Integration
       Music & Video Hub
       Universal Volume Control (UVC), launch app, controls, contextual info
       Contextual launch – Start menu, UVC, Music & Video Hub
   App Integration
       App can retrieve playback status, progress, & metadata
       Playback notification registration

    Windows Phone                                   32
Demo

Demo 5: Audio
Tiles and
Notifications
Consumer Experience
 Windows phone has the unique
  ability to provide the end user
  glanceable access to the
  information they care most
  about, via Live Tiles
                  +
 Push Notifications offer
  developers a way to send timely
  information to the end user’s
  device even when the
    Windows Phone
Tiles 101
 Shortcuts to apps
 Static or dynamic
 2 sizes: small &
  large
    Large only for 1st

     party apps
 End-user is in
    Windows Phone
Data Driven Template Model

 A fixed set of data properties
 Each property corresponds to a UI
  element
 Each UI element has a fixed position on
  screen
 Not all elements need to be used
    Background Image
     (173 x 173 .png)
                        Title   Count

     Windows Phone
Scenarios/Popular Applications
   Weather Apps            Send to WP7
        Weather Tile            Link Tile
        Warning Toast           Link Toast
   Chess by Post           AlphaJax
        Turn Tile               Turn Tile
        Move Toast              Move Toast
   Beezz                   Seattle Traffic Map
        Unread Tile             Traffic Tile
        Direct Toast



    Windows Phone
Primary and Secondary Tiles
   Application Tile                            Front

     Pinned from App List
     Properties are set initially in the
      Application Manifest                      Bac
                                                k

   Secondary Tile
     New in Windows Phone 7.5!
     Created as a result of user input in an
      application
    Windows Phone
Live Tiles – Local Tile API
   Local tile updates (these are *not* push)
      Full control of all properties when your app
         is in the foreground or background
      Calorie counter, sticky notes
   Multi-Tile!
      Deep-link to specific application sections
      Launch directly to page/experience




    Windows Phone
Live Tiles – Local Tile API
Continued…
   Back of tile updates
      Full control of all properties when your app
       is in the foreground or background
      Content, Title, Background
      Content       Content
      string is                                          Background
      bigger
                              Title   Title



          Flips from front to back at random interval
          Smart logic to make flips asynchronous
    Windows Phone
Demo

Demo 1: Live Tiles – Local Tile API
Tile Schedule
   Periodically updates the tile image without pushing message though
   Updates images only from the web, not from the app local store
   Sets up notification channel and binds it to a tile notification
   Few limitations
      Image size must be less than 80 KB
      Download time must not exceed 60 seconds
      Lowest update time resolution is 60 minutes
      If the schedule for an indefinite or finite number of updates fails
        too many times, OS will cancel it
   Update recurrence can by Onetime, EveryHour, EveryDay,
    EveryWeek or EveryMonth
    Windows Phone
Scheduling Tile Update
public partial class MainPage : PhoneApplicationPage {
    private ShellTileSchedule _mySchedule;
    public MainPage() {
        InitializeComponent();
        ScheduleTile();
    }

     private void ScheduleTile()    {
        _mySchedule = new ShellTileSchedule();
        _mySchedule.Recurrence = UpdateRecurrence.Onetime;
        _mySchedule.StartTime = DateTime.Now;
        _mySchedule.RemoteImageUri = new
                          Uri("http://cdn3.afterdawn.fi/news/small/windows-phone-7-series.png");
        _mySchedule.Start();
    }
}


    Windows Phone
Updating Tiles from a Background
Agent
   In Windows Phone OS 7.0, only way of updating Live Tiles was from a Tile
    Schedule or from Notifications
       Tile Schedule needs to fetch images from
        a web URI
       Notifications require you to implement a
        backend service
   To have control of shell tiles when the app is not running without using Push
    Notifications, a good solution is a Background Agent
          Use the ShellTile API to locate and
           update tiles
    Windows Phone
Demo

Demo 2: Updating Tiles from a Background
Agent
Push Notifications

 Server-initiated communication
 Enable key background scenarios
 Preserve battery life and user
  experience
 Prevent polling for updates

    Windows Phone
Push Notification Data Flow
                                    2                    URI to the service:
                                        "http://notify.live.com/throttledthirdparty/01.00/AAFRQHgiiMWN
                                                                                                                  3rd party
                    Push enabled                                   TYrRDXAHQtz-                                    service
                     applications           AgrNpzcDAwAAAAQOMDAwMDAwMDAwMDAwMDA"
                                                                                                              3
                    Notifications
                      service                                                                            HTTP POST the
                                                                     4                                     message
                                                                                Send PN
                                                                                Message
1      Push endpoint is established. URI is created
                   for the endpoint.
                                                                                                              Microsoft
                                                                                                                hosted
                                                                                                                server




    Windows Phone
Three Kinds of Notifications
   Raw
          Notification message content is application-specific
          Delivered directly to app only if it is running
   Toast
          Specific XML schema
          Content delivered to app if it is running
          If app is not running, system displays Toast popup using notification message content
   Tile
          Specific XML schema
          Never delivered to app
          If user has pinned app tile to Start screen, system updates it using notification message
           content

    Windows Phone
Push Notifications – New Features
   Multi-Tile/Back of Tile Support
      Multiple weather locations, news categories,
       sports team scores, twitter favorites
      Can update all tiles belonging to your application
   No API Change for binding tiles
      BindToShellTile now binds you to all tiles
      Send Tile ID to service and use new attribute to
       direct update
   Three new elements for back of tile properties
    Windows Phone
Toast Notification

 App icon and two text fields
 Time critical and personally relevant
 Users must opt-in via app UI




    Windows Phone
Response Custom Headers
   Response Code: HTTP status code (200 OK)
   Notification Status
          Notification received by the Push Notification Service
          For example: “X-NotificationStatus:Received”
   DeviceConnectionStatus
          The connection status of the device
          //For example: X-DeviceConnectionStatus:Connected
   SubscriptionStatus
          The subscription status
          //For example: X-SubscriptionStatus:Active
   More information
          http://msdn.microsoft.com/en-us/library/ff402545(v=VS.92).aspx

    Windows Phone
XNA and Silverlight
integration
Xna and Silverlight combined

 It is now possible to create an application that
  combines XNA and Silverlight
 The XNA runs within a Silverlight page
 This makes it easy to use XNA to create
  gameplay and Silverlight to build the user
  interface
 Possible to put Silverlight elements onto an XNA
  game screen so the user can interact with both
  elements at the same time
    Windows Phone                                    57
Creating a Combined Project




   This project contains both Silverlight and
    XNA elements
    Windows Phone                                58
A combined solution

 A combined solution contains three
  projects
   The Silverlight project
   An XNA library project
   The content project
 These are created automatically
  by Visual Studio
    Windows Phone                      59
The XNA GamePage
   The XNA gameplay is
    displayed on a specific
    Silverlight page that is
    added to the project when it
    is created
   When this page is
    navigated to the XNA game
    behind it will start running
   However, the Silverlight
    system is still active around
    Windows Phone                   60
Starting a Combined Application
 When the combined
  application starts the
  MainPage is displayed
 It contains a button that can
  be used to navigate to the
  game page
 You can build your own
    Windows Phone                 61
Navigating to the game page
private void Button_Click(object sender,
                           RoutedEventArgs e)
{
    NavigationService.Navigate(new Uri("/GamePage.xaml",
                                UriKind.Relative));
}


   This is the button event hander in
    MainPage.xaml.cs
   Navigating to the page will trigger the XNA
    gameplay to start
    Windows Phone
The game page
protected override void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedFrom(NavigationEventArgs e)
private void OnUpdate(object sender, GameTimerEventArgs e)
private void OnDraw(object sender, GameTimerEventArgs e)

     These are the methods on the game page that contorl
      gameplay
        OnNavigatedTo will do the job of the Initialize and
         LoadContent methods
        OnNavigatedFrom is used to suspend the game
        OnUpdate is the Update method
        OnDraw is the Draw method
      Windows Phone
Combining XNA and Silverlight
    <!--No XAML content is required as the page is rendered
    entirely with the XNA Framework-->


 The default combined project does not contain
  any XAML content for the XNA page
 If XAML elements are added to this page they will
  not be displayed without some extra code
    The Silverlight page is rendered to a texture
      which is drawn in the XNA game
 We have to add the code to do this
     Windows Phone
Demo
6: Silverlight and XNA
Summary

 Get the new tools at
  http://create.msdn.com
 Windows Phone Mango Jumpstart




    Windows Phone                 66

Mais conteúdo relacionado

Destaque

Internet 2020: The Future Connection
Internet 2020: The Future ConnectionInternet 2020: The Future Connection
Internet 2020: The Future ConnectionChristine Nolan
 
PPT ON GUIDED MISSILES
PPT ON GUIDED MISSILESPPT ON GUIDED MISSILES
PPT ON GUIDED MISSILESSneha Jha
 
Green computing ppt
Green computing  pptGreen computing  ppt
Green computing pptneenasahni
 
India Nuclear Weapon Programs Ppt
India Nuclear Weapon Programs PptIndia Nuclear Weapon Programs Ppt
India Nuclear Weapon Programs Pptguest99f39df
 
[Infographic] How will Internet of Things (IoT) change the world as we know it?
[Infographic] How will Internet of Things (IoT) change the world as we know it?[Infographic] How will Internet of Things (IoT) change the world as we know it?
[Infographic] How will Internet of Things (IoT) change the world as we know it?InterQuest Group
 

Destaque (8)

Missile guidance
Missile guidanceMissile guidance
Missile guidance
 
Internet 2020: The Future Connection
Internet 2020: The Future ConnectionInternet 2020: The Future Connection
Internet 2020: The Future Connection
 
PPT ON GUIDED MISSILES
PPT ON GUIDED MISSILESPPT ON GUIDED MISSILES
PPT ON GUIDED MISSILES
 
Green computing ppt
Green computing  pptGreen computing  ppt
Green computing ppt
 
India Nuclear Weapon Programs Ppt
India Nuclear Weapon Programs PptIndia Nuclear Weapon Programs Ppt
India Nuclear Weapon Programs Ppt
 
Missile Technology
Missile TechnologyMissile Technology
Missile Technology
 
Robotics project ppt
Robotics project pptRobotics project ppt
Robotics project ppt
 
[Infographic] How will Internet of Things (IoT) change the world as we know it?
[Infographic] How will Internet of Things (IoT) change the world as we know it?[Infographic] How will Internet of Things (IoT) change the world as we know it?
[Infographic] How will Internet of Things (IoT) change the world as we know it?
 

Semelhante a What's new in Windows Phone Mango for Developers

Windows Phone and mobile application development
Windows Phone and mobile application developmentWindows Phone and mobile application development
Windows Phone and mobile application developmentIT Booze
 
Windows Phone Application Platform
Windows Phone Application PlatformWindows Phone Application Platform
Windows Phone Application PlatformDave Bost
 
Windows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's NewWindows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's NewSascha Corti
 
Windows phone 8 session 10
Windows phone 8 session 10Windows phone 8 session 10
Windows phone 8 session 10hitesh chothani
 
Android training course
Android training courseAndroid training course
Android training courseAdarsh Pandey
 
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...DroidConTLV
 
An end-to-end experience of Windows Phone 7 development (Part 1)
An end-to-end experience of Windows Phone 7 development (Part 1)An end-to-end experience of Windows Phone 7 development (Part 1)
An end-to-end experience of Windows Phone 7 development (Part 1)rudigrobler
 
Bn0202 operatingsystemsfeaturesandfunctions
Bn0202 operatingsystemsfeaturesandfunctionsBn0202 operatingsystemsfeaturesandfunctions
Bn0202 operatingsystemsfeaturesandfunctionsPanzer944
 
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?soft-shake.ch
 
Sinergija 11 WP7 Mango multitasking and “multitasking”
Sinergija 11   WP7 Mango multitasking and “multitasking”Sinergija 11   WP7 Mango multitasking and “multitasking”
Sinergija 11 WP7 Mango multitasking and “multitasking”Catalin Gheorghiu
 
Dori waldman android _course_2
Dori waldman android _course_2Dori waldman android _course_2
Dori waldman android _course_2Dori Waldman
 
Windows Phone Concept - 7.1 & 8 Preview
Windows Phone Concept - 7.1 & 8 PreviewWindows Phone Concept - 7.1 & 8 Preview
Windows Phone Concept - 7.1 & 8 PreviewPou Mason
 
Android : a linux-based mobile operating system
Android : a linux-based mobile operating systemAndroid : a linux-based mobile operating system
Android : a linux-based mobile operating systemClément Escoffier
 
Phonegap deep-dive
Phonegap deep-divePhonegap deep-dive
Phonegap deep-divealunny
 
07 wp7 application lifecycle
07 wp7   application lifecycle07 wp7   application lifecycle
07 wp7 application lifecycleTao Wang
 

Semelhante a What's new in Windows Phone Mango for Developers (20)

Windows Phone and mobile application development
Windows Phone and mobile application developmentWindows Phone and mobile application development
Windows Phone and mobile application development
 
Windows Phone Application Platform
Windows Phone Application PlatformWindows Phone Application Platform
Windows Phone Application Platform
 
Windows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's NewWindows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's New
 
Windows 8 BootCamp
Windows 8 BootCampWindows 8 BootCamp
Windows 8 BootCamp
 
Windows phone 8 session 10
Windows phone 8 session 10Windows phone 8 session 10
Windows phone 8 session 10
 
Windows Phone Fast App Switching, Tombstoning and Multitasking
Windows Phone Fast App Switching, Tombstoning and MultitaskingWindows Phone Fast App Switching, Tombstoning and Multitasking
Windows Phone Fast App Switching, Tombstoning and Multitasking
 
Windows 8 Client Part 2 "The Application internals for IT-Pro's"
Windows 8 Client Part 2 "The Application internals for IT-Pro's"  Windows 8 Client Part 2 "The Application internals for IT-Pro's"
Windows 8 Client Part 2 "The Application internals for IT-Pro's"
 
Android training course
Android training courseAndroid training course
Android training course
 
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
 
An end-to-end experience of Windows Phone 7 development (Part 1)
An end-to-end experience of Windows Phone 7 development (Part 1)An end-to-end experience of Windows Phone 7 development (Part 1)
An end-to-end experience of Windows Phone 7 development (Part 1)
 
Android os
Android osAndroid os
Android os
 
Bn0202 operatingsystemsfeaturesandfunctions
Bn0202 operatingsystemsfeaturesandfunctionsBn0202 operatingsystemsfeaturesandfunctions
Bn0202 operatingsystemsfeaturesandfunctions
 
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
 
Sinergija 11 WP7 Mango multitasking and “multitasking”
Sinergija 11   WP7 Mango multitasking and “multitasking”Sinergija 11   WP7 Mango multitasking and “multitasking”
Sinergija 11 WP7 Mango multitasking and “multitasking”
 
Dori waldman android _course_2
Dori waldman android _course_2Dori waldman android _course_2
Dori waldman android _course_2
 
Windows Phone Concept - 7.1 & 8 Preview
Windows Phone Concept - 7.1 & 8 PreviewWindows Phone Concept - 7.1 & 8 Preview
Windows Phone Concept - 7.1 & 8 Preview
 
Android : a linux-based mobile operating system
Android : a linux-based mobile operating systemAndroid : a linux-based mobile operating system
Android : a linux-based mobile operating system
 
Phonegap deep-dive
Phonegap deep-divePhonegap deep-dive
Phonegap deep-dive
 
Android OS
Android OSAndroid OS
Android OS
 
07 wp7 application lifecycle
07 wp7   application lifecycle07 wp7   application lifecycle
07 wp7 application lifecycle
 

Mais de Glen Gordon

Windows Phone Garage - Application Jumpstart
Windows Phone Garage - Application JumpstartWindows Phone Garage - Application Jumpstart
Windows Phone Garage - Application JumpstartGlen Gordon
 
OData for iOS developers
OData for iOS developersOData for iOS developers
OData for iOS developersGlen Gordon
 
Windows Phone 7 Services
Windows Phone 7 ServicesWindows Phone 7 Services
Windows Phone 7 ServicesGlen Gordon
 
Windows Phone 7 and Silverlight
Windows Phone 7 and SilverlightWindows Phone 7 and Silverlight
Windows Phone 7 and SilverlightGlen Gordon
 
Windows phone 7 xna
Windows phone 7 xnaWindows phone 7 xna
Windows phone 7 xnaGlen Gordon
 
XNA and Windows Phone
XNA and Windows PhoneXNA and Windows Phone
XNA and Windows PhoneGlen Gordon
 
Introduction to Microsoft Silverlight
Introduction to Microsoft SilverlightIntroduction to Microsoft Silverlight
Introduction to Microsoft SilverlightGlen Gordon
 
Microsoft Web Platform and Internet Explorer 8 for PHP developers
Microsoft Web Platform and Internet Explorer 8 for PHP developersMicrosoft Web Platform and Internet Explorer 8 for PHP developers
Microsoft Web Platform and Internet Explorer 8 for PHP developersGlen Gordon
 

Mais de Glen Gordon (8)

Windows Phone Garage - Application Jumpstart
Windows Phone Garage - Application JumpstartWindows Phone Garage - Application Jumpstart
Windows Phone Garage - Application Jumpstart
 
OData for iOS developers
OData for iOS developersOData for iOS developers
OData for iOS developers
 
Windows Phone 7 Services
Windows Phone 7 ServicesWindows Phone 7 Services
Windows Phone 7 Services
 
Windows Phone 7 and Silverlight
Windows Phone 7 and SilverlightWindows Phone 7 and Silverlight
Windows Phone 7 and Silverlight
 
Windows phone 7 xna
Windows phone 7 xnaWindows phone 7 xna
Windows phone 7 xna
 
XNA and Windows Phone
XNA and Windows PhoneXNA and Windows Phone
XNA and Windows Phone
 
Introduction to Microsoft Silverlight
Introduction to Microsoft SilverlightIntroduction to Microsoft Silverlight
Introduction to Microsoft Silverlight
 
Microsoft Web Platform and Internet Explorer 8 for PHP developers
Microsoft Web Platform and Internet Explorer 8 for PHP developersMicrosoft Web Platform and Internet Explorer 8 for PHP developers
Microsoft Web Platform and Internet Explorer 8 for PHP developers
 

Último

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Último (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

What's new in Windows Phone Mango for Developers

  • 1. Highlights of What’s New in Windows Phone Mango Glen Gordon Developer Evangelist, Microsoft http://glengordon.name
  • 2. Topics  Fast Application Switching  Background Agents  Live Tiles  XNA/Silverlight integration Windows Phone
  • 4. Application Lifecycle - Dormant App Resume Fast running State preserved! e.IsApplicationInstancePreserved Save State! == true activated deactivated dormant Phone resources detached Threads & timers suspended Windows Phone
  • 5. Application Lifecycle - Tombstoned .. Resuming . Restore state! e.IsApplicationInstancePreserved running == false activated deactivated Tombstone Tombstoned dormant Phone resources detached the oldest Threads & timers suspended app Windows Phone
  • 6. Methods & Events Windows Phone 6
  • 7. Finding the Resume type private void Application_Activated(object sender, ActivatedEventArgs e) { if (e.IsApplicationInstancePreserved) { // Dormant - objects in memory intact } else { // Tombstoned - need to reload } }  The Activation handler can test a flag to determine the type of resume taking place Windows Phone
  • 8. Deactivation Resource Management MediaPlayer.Pause MediaElement.Pause SoundEffectInstance.Pause VibrateController.Stop PhotoCamera.Dispose Save page/global state XNA Audio Paused Sensors Notifications suppressed Networking Cancelled Sockets Disconnected MediaElement Disconnected Camera Disposed Windows Phone
  • 9. Activation Resource Management MediaElement.Source/Position/Play Socket.ConnectAsync new PhotoCamera/VideoCamera Restore app state if tombstoned XNA Audio Resumed Sensors Notifications resumed Networking Completed with Cancellation Sockets - MediaElement - Camera - Windows Phone
  • 10. Isolated Storage vs State Storage  Isolated storage is so called because the data for an application is isolated from all other applications  It can be used as filestore where an application can store folders and files  It is slow to access, since it is based on NVRAM technology  It can also be used to store name/value pairs, e.g. program settings  State storage is so called because it is used to hold the state of an application  It can be used to store name/value pairs which are held in memory for dormant or tombstoned applications  It provides very quick access to data Windows Phone 10
  • 11. Captain’s Log Demo • With No Storage • With Storage • Fully Working
  • 13. Multitasking Capabilities  Background Agents  Periodic  Resource Intensive  Background Transfer Service  Alarms and Reminders  Background Audio Windows Phone 14
  • 14. Background Agents  Agents  Periodic  Resource Intensive  An app may have up to one of each  Initialized in foreground, run in background  Persisted across reboots  User control through Settings  System maximum of 18 periodic agent  Agent runs for up to 14 days (can be renewed) 15 Windows Phone
  • 15. Generic Agent Types Periodic Agents Resource Intensive  Occurrence Agents  Every 30 min  Occurrence  Duration  External power  ~15 seconds  Non-cell network  Constraints  Duration  <= 6 MB Memory  10 minutes  <=10% CPU  Constraints  <= 6 MB Memory 16
  • 16. Background Agent Functionality Allowed Restricted  Tiles  Toast  Display UI  Location  XNA libraries  Network  Microphone and Camera  R/W ISO store  Sensors  Sockets  Play audio (may only use background audio APIs)  Most framework APIs 17 Windows Phone
  • 18. Debugging a Background Task #if DEBUG_AGENT ScheduledActionService.LaunchForTest(taskName, TimeSpan.FromSeconds(60)); #endif  It would be annoying if we had to wait 30 minutes to get code in the agent running so we could debug it  When we are debugging we can force service to launch itself  Such code can be conditionally compiled and removed before the production version is built Windows Phone 19
  • 19. Debugging the Agent Code  When you use the Back button or Start on the phone to interrupt an application with an active Background Task ,Visual Studio does not stop running  It remains attached to the application  You can then put breakpoints into the background task application and debug them as you would any other program  You can single step, view the contents of variables and even change them using the Immediate Window  This is also true if you are working on a device rather than the emulator  The same techniques work on ResourceIntensiveAgents Windows Phone 20
  • 21. File Transfer Tasks  It is also possible to create a background task to transfer files to and from your application’s isolated storage  The transfers will continue to work even when the application is not running  An application can monitor the state of the downloads and display their status  Files can be fetched from HTTP or HTTPs hosts  At the moment FTP is not supported  The system maintains a queue of active transfers and services each one in turn  Applications can query the state of active transfers Windows Phone 22
  • 22. Background Transfer Policies  There are a set of policies that control transfer behavior  Maximum Upload file size: 5Mb  Maximum Download file size over cellular (mobile phone) data: 20Mb  Maximum Download file size over WiFi: 100Mb  These can be modified by setting the value of TransferPreferences on a particular transfer Windows Phone 23
  • 23. Transfer Management  An application can find out how many file transfers it has active  It will have to do this when it is restarted, as file transfers will continue even when the application is not running  It can then perform transfer management as required  There is a good example of transfer list management on MSDN: http://msdn.microsoft.com/en-us/library/hh202953.aspx Windows Phone
  • 25. Scheduled Notifications  Time-based, on-phone notifications  Supports Alerts & Reminders  Persist across reboots  Adheres to user settings  Consistent with phone UX Windows Phone 26
  • 26. Alarms vs Reminders? Alarms Reminde rs • Modal • Rich information • Snooze and Dismiss • Integrates with other reminders • Sound customization • Snooze and Dismiss • No app invocation • Launch app • No stacking • Follows the phones global settings 27
  • 27. Creating a Reminder using Microsoft.Phone.Scheduler; ... eggReminder = new Reminder("Egg Timer"); eggReminder.BeginTime = DateTime.Now + new TimeSpan(0, eggTime, 0); eggReminder.Content = "Egg Ready"; eggReminder.RecurrenceType = RecurrenceInterval.None; eggReminder.NavigationUri = new Uri("/EggReadyPage.xaml", UriKind.Relative); ScheduledActionService.Add(eggReminder);  This code creates a reminder and adds it as a scheduled service  The value eggTime holds the length of the delay  This code also sets the url of the page in the application Windows Phone 28
  • 28. Reminder Housekeeping Reminder eggReminder = ScheduledActionService.Find("Egg Timer") as Reminder; if ( eggReminder != null ) { ScheduledActionService.Remove("Egg Timer"); }  Reminders are identified by name  This code finds the “Egg Timer” reminder and then removes it from the scheduler Windows Phone 29
  • 30. Audio Playback Agents  It is also possible to create an Audio Playback Agent that will manage an application controlled playlist  The mechanism is the same as for other background tasks  The audio can be streamed or held in the application isolated storage Windows Phone 31
  • 31. Background Audio  Playback  App provides URL or stream to Zune  Audio continues to play even if app is closed  App is notified of file or buffer near completion  Phone Integration  Music & Video Hub  Universal Volume Control (UVC), launch app, controls, contextual info  Contextual launch – Start menu, UVC, Music & Video Hub  App Integration  App can retrieve playback status, progress, & metadata  Playback notification registration Windows Phone 32
  • 34. Consumer Experience  Windows phone has the unique ability to provide the end user glanceable access to the information they care most about, via Live Tiles +  Push Notifications offer developers a way to send timely information to the end user’s device even when the Windows Phone
  • 35. Tiles 101  Shortcuts to apps  Static or dynamic  2 sizes: small & large  Large only for 1st party apps  End-user is in Windows Phone
  • 36. Data Driven Template Model  A fixed set of data properties  Each property corresponds to a UI element  Each UI element has a fixed position on screen  Not all elements need to be used Background Image (173 x 173 .png) Title Count Windows Phone
  • 37. Scenarios/Popular Applications  Weather Apps  Send to WP7  Weather Tile  Link Tile  Warning Toast  Link Toast  Chess by Post  AlphaJax  Turn Tile  Turn Tile  Move Toast  Move Toast  Beezz  Seattle Traffic Map  Unread Tile  Traffic Tile  Direct Toast Windows Phone
  • 38. Primary and Secondary Tiles  Application Tile Front  Pinned from App List  Properties are set initially in the Application Manifest Bac k  Secondary Tile  New in Windows Phone 7.5!  Created as a result of user input in an application Windows Phone
  • 39. Live Tiles – Local Tile API  Local tile updates (these are *not* push)  Full control of all properties when your app is in the foreground or background  Calorie counter, sticky notes  Multi-Tile!  Deep-link to specific application sections  Launch directly to page/experience Windows Phone
  • 40. Live Tiles – Local Tile API Continued…  Back of tile updates  Full control of all properties when your app is in the foreground or background  Content, Title, Background Content Content string is Background bigger Title Title  Flips from front to back at random interval  Smart logic to make flips asynchronous Windows Phone
  • 41. Demo Demo 1: Live Tiles – Local Tile API
  • 42. Tile Schedule  Periodically updates the tile image without pushing message though  Updates images only from the web, not from the app local store  Sets up notification channel and binds it to a tile notification  Few limitations  Image size must be less than 80 KB  Download time must not exceed 60 seconds  Lowest update time resolution is 60 minutes  If the schedule for an indefinite or finite number of updates fails too many times, OS will cancel it  Update recurrence can by Onetime, EveryHour, EveryDay, EveryWeek or EveryMonth Windows Phone
  • 43. Scheduling Tile Update public partial class MainPage : PhoneApplicationPage { private ShellTileSchedule _mySchedule; public MainPage() { InitializeComponent(); ScheduleTile(); } private void ScheduleTile() { _mySchedule = new ShellTileSchedule(); _mySchedule.Recurrence = UpdateRecurrence.Onetime; _mySchedule.StartTime = DateTime.Now; _mySchedule.RemoteImageUri = new Uri("http://cdn3.afterdawn.fi/news/small/windows-phone-7-series.png"); _mySchedule.Start(); } } Windows Phone
  • 44. Updating Tiles from a Background Agent  In Windows Phone OS 7.0, only way of updating Live Tiles was from a Tile Schedule or from Notifications  Tile Schedule needs to fetch images from a web URI  Notifications require you to implement a backend service  To have control of shell tiles when the app is not running without using Push Notifications, a good solution is a Background Agent  Use the ShellTile API to locate and update tiles Windows Phone
  • 45. Demo Demo 2: Updating Tiles from a Background Agent
  • 46. Push Notifications  Server-initiated communication  Enable key background scenarios  Preserve battery life and user experience  Prevent polling for updates Windows Phone
  • 47. Push Notification Data Flow 2 URI to the service: "http://notify.live.com/throttledthirdparty/01.00/AAFRQHgiiMWN 3rd party Push enabled TYrRDXAHQtz- service applications AgrNpzcDAwAAAAQOMDAwMDAwMDAwMDAwMDA" 3 Notifications service HTTP POST the 4 message Send PN Message 1 Push endpoint is established. URI is created for the endpoint. Microsoft hosted server Windows Phone
  • 48. Three Kinds of Notifications  Raw  Notification message content is application-specific  Delivered directly to app only if it is running  Toast  Specific XML schema  Content delivered to app if it is running  If app is not running, system displays Toast popup using notification message content  Tile  Specific XML schema  Never delivered to app  If user has pinned app tile to Start screen, system updates it using notification message content Windows Phone
  • 49. Push Notifications – New Features  Multi-Tile/Back of Tile Support  Multiple weather locations, news categories, sports team scores, twitter favorites  Can update all tiles belonging to your application  No API Change for binding tiles  BindToShellTile now binds you to all tiles  Send Tile ID to service and use new attribute to direct update  Three new elements for back of tile properties Windows Phone
  • 50. Toast Notification  App icon and two text fields  Time critical and personally relevant  Users must opt-in via app UI Windows Phone
  • 51. Response Custom Headers  Response Code: HTTP status code (200 OK)  Notification Status  Notification received by the Push Notification Service  For example: “X-NotificationStatus:Received”  DeviceConnectionStatus  The connection status of the device  //For example: X-DeviceConnectionStatus:Connected  SubscriptionStatus  The subscription status  //For example: X-SubscriptionStatus:Active  More information  http://msdn.microsoft.com/en-us/library/ff402545(v=VS.92).aspx Windows Phone
  • 53. Xna and Silverlight combined  It is now possible to create an application that combines XNA and Silverlight  The XNA runs within a Silverlight page  This makes it easy to use XNA to create gameplay and Silverlight to build the user interface  Possible to put Silverlight elements onto an XNA game screen so the user can interact with both elements at the same time Windows Phone 57
  • 54. Creating a Combined Project  This project contains both Silverlight and XNA elements Windows Phone 58
  • 55. A combined solution  A combined solution contains three projects  The Silverlight project  An XNA library project  The content project  These are created automatically by Visual Studio Windows Phone 59
  • 56. The XNA GamePage  The XNA gameplay is displayed on a specific Silverlight page that is added to the project when it is created  When this page is navigated to the XNA game behind it will start running  However, the Silverlight system is still active around Windows Phone 60
  • 57. Starting a Combined Application  When the combined application starts the MainPage is displayed  It contains a button that can be used to navigate to the game page  You can build your own Windows Phone 61
  • 58. Navigating to the game page private void Button_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate(new Uri("/GamePage.xaml", UriKind.Relative)); }  This is the button event hander in MainPage.xaml.cs  Navigating to the page will trigger the XNA gameplay to start Windows Phone
  • 59. The game page protected override void OnNavigatedTo(NavigationEventArgs e) protected override void OnNavigatedFrom(NavigationEventArgs e) private void OnUpdate(object sender, GameTimerEventArgs e) private void OnDraw(object sender, GameTimerEventArgs e)  These are the methods on the game page that contorl gameplay  OnNavigatedTo will do the job of the Initialize and LoadContent methods  OnNavigatedFrom is used to suspend the game  OnUpdate is the Update method  OnDraw is the Draw method Windows Phone
  • 60. Combining XNA and Silverlight <!--No XAML content is required as the page is rendered entirely with the XNA Framework-->  The default combined project does not contain any XAML content for the XNA page  If XAML elements are added to this page they will not be displayed without some extra code  The Silverlight page is rendered to a texture which is drawn in the XNA game  We have to add the code to do this Windows Phone
  • 62. Summary  Get the new tools at http://create.msdn.com  Windows Phone Mango Jumpstart Windows Phone 66