Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Windows Phone Introduction

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Chargement dans…3
×

Consultez-les par la suite

1 sur 50 Publicité

Windows Phone Introduction

Télécharger pour lire hors ligne

Giới thiệu lập trình trên nền tảng Windows Phone
- Design
- Market share
- Application Type
- Development Tool
- Features
- Application LifeCycle

Giới thiệu lập trình trên nền tảng Windows Phone
- Design
- Market share
- Application Type
- Development Tool
- Features
- Application LifeCycle

Publicité
Publicité

Plus De Contenu Connexe

Diaporamas pour vous (20)

Similaire à Windows Phone Introduction (20)

Publicité

Plus par Tung Nguyen Thanh (20)

Publicité

Windows Phone Introduction

  1. 1. Windows Phone 8 Programming Introduction
  2. 2. Nguyen Thanh Tung • CSA at MISA JSC • Mostly working with Microsoft technologies: • XAML • Silverlight • Entity Framework • ASP.NET • Windows Phone • Windows 8 and more • http://tungnt.net • https://www.facebook.com/tungnt185
  3. 3. Agenda • Windows Phone 8 (WP8) introduction – The most interesting features – Marketshare • WP8 application lifecycle, software architecture & deployment process • Developing tools – Microsoft Visual Studio 2013 & Expression Blend – VS2013 project template – Third party control for designing user interface (UI) • C# basics
  4. 4. History of Microsoft Mobile OS Windows CE OS (2000) Windows Mobile (2003 – 2009) Windows Phone 7 (11/2010) Windows Phone 7.5 Mango (5/2011) Windows Phone 8 & 7.8 (10/2012) Windows Phone 8.1 (8/2014)
  5. 5. Windows® Phone 8 A different kind of phone designed to bring together what you care about most – easier and faster Smart design Glance and go experience Designed to do more in less steps Windows Phone Hubs Organized to get everything you love easier and faster Optimized Ecosystem Rich platform and tools on optimized hardware
  6. 6. Smart Design • Metro Styles • App Bar
  7. 7. Hubs • People • Office • Pictures • Music & Video • Marketplace • Games • Wallet
  8. 8. Top 3 Smartphone OS
  9. 9. Windows Phone Market Share
  10. 10. VietNam Smartphone Market Share
  11. 11. Windows Phone Store More than 300.000 app
  12. 12. Monetizing With Windows Phone App • Paid App: – 0.99$, 499$... • Free App with Advertising: – PubCenter, AdMod – VServ, MobFox … • In-App Purchases: – New Add-ons, New Items, New level…
  13. 13. One App Model, three technology choices* – XAML with C#/VB – Native C/C++ – HTML5 browser control *Not exclusive, can mix and match Three Flavors of Applications
  14. 14. Windows Phone 8 app models Windows Phone 8 API Set
  15. 15. Deployment Process Develop & Debug Submit & Validate Certify & Sign Windows Phone Application Deployment Service Marketplace • Store deployment
  16. 16. Deployment Process • Company enrollment
  17. 17. Tool for developing WP8 application • Features: – Develop three types application: • XAML with C#/VB • Native C/C++ • HTML5 browser control – Windows Phone 8 Emulator for testing apps – Power debugging capabilities of Visual Studio family – Designer support good enough to create the UI
  18. 18. Microsoft Expression Blend for WP Expression Blend is used to design beautiful User Interface: – You can build amazing experiences relatively easy – Has a learning curve, especially for developers • The tool is powerful but use it ‘wisely’ for Windows Phone UI design • The tool of choice for transitions / animations • Has great support for showing / testing data driven UI elements – Can be used in combination with Visual Studio 2013 • Uses the same Windows Phone Emulator to test experiences
  19. 19. Microsoft Expression Blend for WP
  20. 20. Visual Studio’s project template • New and Updated Project Templates – HTML5, Localization Support, Alignment Grid – Direct3D support with Native C++
  21. 21. Visual Studio’s project template Template Description Windows Phone Application Creates a project that can be used as a starting point for any Silverlight for Windows Phone application. Windows Phone Databound Application Creates a project that uses the ListBox control and navigation features. In addition, this template creates an application using the Model-View-ViewModel design pattern. Windows Phone Class Library Creates a class library project that compiles as an assembly by default. This template has no UI elements and can be shared with other applications. Windows Phone Panorama Application Creates a project that uses a Panorama control that allows you to view controls, data, and services by using a long horizontal canvas that extends beyond the confines of the screen. Windows Phone Pivot Application Creates a project that uses a Pivot control to enable the you to switch between views or pages within the application. • Windows Phone project template
  22. 22. Visual Studio’s project template Template Description Windows Phone XAML and Direct3D App Creating a Windows Phone managed application with native components. Windows Phone Silverlight and XNA Application Creates a project that enables the rendering of Silverlight and XNA Framework content in the same application. Windows Phone HTML5 App Creating a Windows Phone application that uses primarily HTML content. Windows Phone Audio Playback Agent Creates a class library project for adding a background agent to play audio files. Windows Phone Audio Streaming Agent Creates a class library project for adding a background agent to play streaming audio files. Windows Phone Scheduled Task Agent Creates a class library project for adding a background agent to perform a periodic or resource-intensive task. Three types of project above compiles as an assembly by default and can be referenced by Silverlight or XNA Framework application projects.
  23. 23. Visual Studio’s project template Template Description Windows Phone Direct3D with XAML App A project for creating a Windows Phone application that uses Direct3D and XAML. Windows Phone Direct3D App (Native Only) A project for creating a Windows Phone app that uses Direct3D. Windows Phone Runtime Component A project for creating a Windows Phone Runtime component for a Windows Phone app. Windows Phone Empty Dynamic Link Library A project for creating a native dynamic-link library for a Windows Phone app. Windows Phone Empty Static Library A project for creating a native static library for a Windows Phone app • C++ project template
  24. 24. WP8 the most interesting features New Hardware • Multi-Core Chipsets – Dual-Core & more… e.g. Qualcomm Snapdragon S4
  25. 25. WP8 the most interesting features 3 Screen Resolutions WVGA 800x480 (15:9) WXGA 1280x768 (15:9) 720p 1280x720 (16:9) *New graphics hardware means that existing apps auto-scale and look amazing on all screens.
  26. 26. WP8 the most interesting features MicroSD Support e.g. Photos, Music, Videos, Installing Apps
  27. 27. WP8 the most interesting features Internet Explorer 10 • Same rendering engine as Windows 8 PCs • SmartScreen anti-phising filter • 4x faster JavaScript performance compared to Windows Phone 7.5 • 2x HTML5 feature support compared to Windows 7.5 (e.g. touch support)
  28. 28. WP8 the most interesting features Native Code • Common platform for Windows Phone 8 and Windows 8 • Native game development platform based on DirectX, C / C++ • Games developers can write the same game for Windows 8 and Windows Phone
  29. 29. WP8 the most interesting features • Better Sharing with NFC Tap-to-share, etc… • Magazine Ads • Business Cards • NFC enabled phones • Windows Surface • Matchmaking (e.g. gaming over p2p network) • Most Complete Wallet Experience – Credit & Debit Cards – Loyalty & Membership Cards – Access Saved Deals – Supports NFC ‘Tap to Pay’ – In-App-Purchases * Secure SIM-based solution in partnership with mobile operators, will see these next year in US, but not at time of launch.
  30. 30. WP8 the most interesting features • Nokia Map Technology – Great global NAVTEQ Map data – Offline map support – Map control for developers – Turn-by-Turn Directions
  31. 31. WP8 the most interesting features • For Business – Sign and deploy apps without going through marketplace – Company Hub
  32. 32. WP8 the most interesting features New Start Screen
  33. 33. Panorama control • Part of the native Windows Phone look and feel • Panorama is a long horizontal canvas • PanoramaItem serves as a container that hosts other content and controls
  34. 34. Pivot control • Provides a quick way to manage views or pages • Pivot is a container of pivot items • PivotItem contain individual page content such as controls, grids, or links
  35. 35. Location and Services • The service obtains location data from multiple sources such as A-GPS, Wi- Fi, and cellular • Allows you to create location- aware applications • Allow location- tracking application to run in the background Location Services + Accuracy - Power - Speed - Indoors - Accuracy + Power + Speed - Wilderness +/- Accuracy +/- Power +/- Speed +/- Urban areas GPS Cell Towers WiFi
  36. 36. Push Notifications
  37. 37. Types of Push Notifications • Tile notifications – Update tile count, title and background image • Toast notifications – Display a on-top-like message • Raw notifications – Can be used in application logic
  38. 38. Accelerometer, Compass, Gyroscope • Motion APIs – Accelerometer determine direction the user is moving the device – Compass determine the relative angle of rotated device – Gyroscope determine rotational velocity of device +Y -Y +X-X +Z -Z
  39. 39. Demo Project Template
  40. 40. WP8 Application Lifecycle
  41. 41. Obscured: popup ui from shell Running Obscured Running Unobscured Games could auto- pause Game could auto- resume • Phone call • Reminder • Battery low
  42. 42. 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 User never knows what happened :-) • Start Button • Accept call • Open toast
  43. 43. Demo Application Lifecycle
  44. 44. Application manifest • File: WMAppManifest.xml – Contains properties and settings that are required when you submit your app to the Windows Phone Store – Ex: Describe your app to OS by Product title …
  45. 45. Building the first WP8 application Item Description App.xaml / App.xaml.cs Defines the entry point of the application, initializes application-scoped resources, and displays the application user interface MainPage.xaml / MainPage.xaml.cs Defines a page with the user interface of the application ApplicationIcon.png An image file with an icon that represents the application icon in the phone’s application list Background.png An image file with an icon that represents the application icon in the start screen SplashScreenImage.jpg This is the image that will first be displayed when the application launches. PropertiesAppManifest.xml An application manifest file required to generate the application package PropertiesAssemblyInfo.cs Contains the name and version metadata that is embedded into the generated assembly PropertiesWMAppManifest.xml A manifest file that includes specific metadata related to a Windows Phone Silverlight application References folder A list of libraries (assemblies) that provide services and functionality that the application requires to work
  46. 46. Remember things • XAML (eXtensible Application Markup Language) • ApplicationLifetimeObject – PhoneApplicationService • RootFrame – PhoneApplicationFrame • PhoneApplicationPage
  47. 47. 3rd control for designing application UI
  48. 48. Summary • Windows Phone 8 (WP8) introduction • WP8 software architecture & deployment process • Tool for developing WP8 application – Microsoft Visual Studio 2012 – Microsoft Expression Blend • Project template for creating WP8 application • WP8 application lifecycle • Third party control for designing application user interface

Notes de l'éditeur

  • Each application moves through the stages of the Application lifecycle.  The application moves from one state to another in response to user actions. Each transition triggers events to which you can (and should) respond.
    The stages/events are
    Launching /Activating
    Running
    Deactivating /Closing
    All of these events are in the Microsoft.Phone.Shell.PhoneApplicationService class.
    Launching
      When the user taps the tile for the application on the start menu the application is started and the Launching event is raised. 
    This always appears as a new instance.  Thus, in handling the launching event you do not use transient state to restore an existing session, though you are free to check isolated storage for new-instance related information (Isolated storage is persistent storage on the phone, and will be covered in detail in an upcoming tutorial).
    To be clear, Launching creates a new instance of your application.
    A “resumed” instance is caused by the Activating event, and the two events are mutually exclusive.
    Running
      Once either the launching or the activating event is handled, the application is running. 
    At this point you may want to start saving settings and other persistent data to reduce the amount that needs to be saved when the application moves from Running to either Closing or Deactivating.
    At Deactivation (see below) you have only 10 seconds to store all your data, so if you have quite a bit of data it can make a tremendous difference if you have incrementally stored data while the application was running, rather than trying to store it all in the deactivation event handler.
    You can enter the running state from either the Launching or Activating state, and you can exit the running state to either the closing or deactivating state.
    Closing or Deactivating
    The user can end the running state in one of two ways.  If the user presses the Back button, backing up past the first page of the application, then they have indicated they are done with the application and the Closing event fires and the application is terminated.  To return to the application, the user will restart, firing the Lunching event.  Since this is a termination and not a suspension, the developer will want to store persistent data to isolated storage, but will not store transient state data, as the next launch will appear to be a new instance, not a resumption of this instance.
    On the other hand, if the user replaces your application in the foreground with another application, you will receive the Deactivating event.  Make no mistake, your application is about to terminate, just as certainly as it did with closing, but here you will store not only the persistent data but also the transient state data, because if you return, you will want to appear to be in the state you were before being deactivated (tombstoned). 
    You store the transient data in a dictionary (the State property of the PhoneApplicationService class). You cannot know if the application will be reactivated or not, so you’ll always store your transient data in the State dictionary. If you are reanimated then this will provide the information you need to restore the application to the previous state. If you are never re-activated then the transient data will be discarded.
    Most important, from the time you receive the deactivation event you have ten seconds to complete all of the actions necessary to be tombstoned, or the application will not be tombstoned, it will be terminated.  Earlier, we mentioned the opportunity to incrementally store data; if storing your data might push you past the ten second limit, then incremental storage becomes a virtual necessity.
    Activating
     After an application has been deactivated, it is possible that it will never be reactivated. On the other hand, it is also possible that the user will return to the application and the user’s experience ought to be that the application has been waiting, in steady state; not that it is being relaunched.
    You prepared for this on deactivation by saving persistent data to isolated storage, and transient data to the State dictionary.  Now, upon activation, you will want to retrieve both the persistent and the transient data, and put the application back into the state it was in at the time it was deactivated. 
    To summarize, and to drive the point home one last time: if the user closes the application (by hitting the Back key past the opening screen) and then re-starts the application, you’ll receive the Launching application and will present a new instance. 
    If the user, on the other hand, deactivates the application (e.g., by launching another application) and then returns to your application, you’ll receive the Activating event and you’ll handle that by restoring the state of the application and appearing to have been alive the entire time. 
    Note, however, that tombstoned applications (those that are deactivated) are actuallyterminated and it really is a new instance when activated; it is the developer’s job to make it appear as though the original application was suspended in the interim.
    -------------------------------------------------

    In WP 7.1, if we click on the start button when an application is running, the application will have the Deactivated event got fired. Usually developers will save any application state in this event handler into the application level dictionary object represented through the PhoneApplicationService.State property and make use of it in the Activated state again. After the Deactivated event got invoked, the application which is in running state is moved to the Dormant state. Most developers get this state unnoticed. In thisDormant state, application still remain in memory but without processing happen and without application getting terminated. Based on the memory resource requirements for other applications, the application in the Dormant state has the possibility to get into the Tombstone state. The Tombstone state for an application represents the application as terminated, in the meantime, it holds the state info of the application. By state info we mean, the application state which is represented through thePhoneApplicationService.State property (as specified above) and the page state which is represented through PhoneApplicationPage.State property. The main thing we need to notice is the reactivation scenario of an application. The application might get  reactivated from both the states directly. In both the cases, it raises the Activated event, where we need to identify whether the application is activated from the Tombstone state. If so, we can get values from the application level state dictionary (PhoneApplicationService.State) and make use of it. If it was from Dormant state, we don't need to do anything as the OS automatically preserves the state. Since both scenarios raises the Activated event, there needs to be a mechanism to identify whether the immediate previous state is Dormant or Tombstone state. It is theIsApplicationInstancePreserved property of the ActivatedEventArgs which helps us to achieve this. As you might guess, if the IsApplicationInstancePreserved is true then it was from Dormant state and if it is false, then it was form Tombstone state.  While debugging your application you can validate both these Dormant and Tombstonestate scenarios by clicking on the start button of your emulator when your application is running . When you click on the start button of the emulator, by default, the application will move to the Dormant state. If you want to validate the Tombstonestate, check the "Tombstone upon deactivation while debugging" check box in theDebug tab of the project properties.
  • <App xmlns="" ProductID="{11b64f67-c88d-4397-98a8-2e5cff5856d3}" Title="Simple Calculator" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="Adding_machine author" Description="Sample description" Publisher="Adding_machine">
    <IconPath IsRelative="true" IsResource="false">CalculatorIcon.png</IconPath>
    <BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
  • The RootFrame property in the Application class identifies the starting page of the application. All Windows Phone applications have a single top-level container element whose data type is PhoneApplicationFrame. The frame hosts one or more PhoneApplicationPage elements that present content for the application. It also handles navigation between pages.
  • Telerik.com

×