Windows phone and azure


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • on the fly
  • on the fly
  • 3+4
  • you get a few seconds to save the current state of the application to a permanent storage.when the app gets reactivated, the user will expect it to return to the same state.a good place to save state while the application is running is the page’s OnNavigatedTo/OnNavigatedFrom methods.
  • from scratch
  • from scratch
  • from scratch
  • from scratch
  • Certification pitfalls:Always closes without exceptionMust not be unresponsive for over 3sMust launch within 5sBack should close app and lead to prev pageNever delay a phone callContent: no violenceor sexual
  • Windows phone and azure

    1. 1. Dovydas Navickasdovydas.nav@gmail.com
    2. 2. agenda o introductiono metro styleo silverlight developmento phone developmento the marketplace
    3. 3. about me o 6 years of developingo 4 years of C# experienceo lecturer at “Prografika”o microsoft student partnero patogiau.lto
    4. 4. introductionfeatures metro tools cloud o new platform o based on familiar technologies and toolso multiple hardware vendors o consistent baseline (cpu, resolution, etc.)o your chance to enter a brand new market!
    6. 6.
    7. 7. metro 
    8. 8. metro 
    9. 9. metroprincipals clean, light, open, fastcelebrate typographyalive in motioncontent, not chrome
    10. 10. metroapp hubs 
    11. 11. introductionfeatures metro tools cloud  Phone Emulator Samples Documentation Guides Community Packaging and Verification Tools
    12. 12. introductionfeatures metro tools cloud  Notifications App Deployment Location Identity Feeds Social Maps
    13. 13. SILVERLIGHT
    14. 14. silverlightintroduction o a subset of the .net framework and WPFo first introduced as a browser plug-in o .net runtime on multiple platforms (mac, windows)o currently targeted for: o device apps (currently windows phones) o client apps (emphasis on enterprise) o rich media apps (such as streaming video)o reuse code for desktop, web and phone apps!
    15. 15. silverlightprincipals o code + xamlo controlso layouto data bindingo graphics
    16. 16. code + xamlo xaml is basically a declarative language for  object instantiationo xaml is great for UI development. it‟s: o standard XML o hierarchical o extensible o declarativeo we can do most things both in xaml and in code, but you‟ll quickly find that xaml is much more convenient for some tasks
    17. 17. code + xamlcomparisonXAML <Grid x:Name="ContentPanel" Margin="12,0,12,0"> <TextBlock Text="Hello, Windows Phone 7!" Margin="6" HorizontalAlignment="Center" VerticalAlignment="Center" /></Grid>C#var tb = new TextBlock();tb.Text = "Hello, Windows Phone 7!";tb.HorizontalAlignment = HorizontalAlignment.Left;tb.VerticalAlignment = VerticalAlignment.Top;tb.Margin = new Thickness(6);ContentPanel.Children.Add(tb);
    18. 18. code + xamlthe visual tree o controls contain other controls, and some controls are built using other controlso this creates a hierarchical relationship between the controls which we call the visual treeo when you write xaml, the structure of the visual tree is very clear
    19. 19. demohello, xaml
    20. 20. controls 
    21. 21. controlsanatomyo inherits from FrameworkElement o two main types: o custom control – a reusable, templatable control (e.g. a button) o user control – a way to modularize your application (e.g. employee view)o uses dependency properties and routed eventso responds to input (touch, keyboard)
    22. 22. controlsdependency properties o extend CLR properties with: o data binding o change notification o animation o validation o control-tree inheritance
    23. 23. controlsrouted events o extend CLR eventso can travel along the visual tree: o bubbling or tunneling
    24. 24. controlsrouted events Root  Element 1 Element 2 Element Element Element Element 1.1 1.2 2.1 2.2  PreviewMouseDown on Root  PreviewMouseDown on Element 1  PreviewMouseDown on Element 1.2  MouseDown (bubble) on Element 1.2  MouseDown (bubble) on Element 1  MouseDown (bubble) on Root
    25. 25. layoutbasic properties Container  Vertical Alignment Margin Horizontal Alignment Padding {Min, Max} Element Height Render Transform {Min, Max} Width
    26. 26. layoutpanels o Grido StackPanelo WrapPanel (*)o Canvaso DockPanelo TabControl* can be found in the silverlight toolkit
    27. 27. demolayout with panels
    28. 28. controlsstyles o defines a set of dependency properties and valueso similar to CSS in HTMLo provides a great way to control the looks of your app from a central location
    29. 29. controlstemplates o completely customize appearance of controls without having to write any code or inherit from the controlo all controls have default styles and templateso template editing is easy with Expression Blend
    30. 30. demotemplate editing in blend
    31. 31. data bindingo flow data from a source to a target  o source: any CLR object o target: Dependency Property only o modes: one way, two wayo supports change notifications o changes to a source object automatically sent to the UI o both property and collection changes are supported
    32. 32. data bindingdata templates o provide a visual representation of an object o the default behavior if no template is specified is to display the Object.ToString() resulto use bindings to display datao respond to changes using triggerso can only be written in xaml
    33. 33. data bindingcollections o use ItemsControl whenever you need to bind to a collectiono provide an ItemTemplate to change the visuals of each itemo controls that inherit from ItemsControl: o ListBox, ContextMenu, MenuItem, Panorama
    34. 34. demodata binding
    35. 35. data bindingthe mvvm patterno designed specifically with business logic and  WPF/Silverlight in mind Model datao relies on bindings to retrieve and set data from and to the view model presentation logic Viewo uses commands to Model and state perform operations on the view modelo relies on notifications to UI (and possibly communicate between the View some UI logic) layerso creates a data-driven UI
    36. 36. graphicsimages o store images as resources or as content o content is recommendedo use the Image control to show themo use WritableBitmap to create images in runtime o you can also use it to capture your screens
    37. 37. graphicsvectors o controls inheriting from Shape can be used to create 2D shapes o Rectangle, Ellipse, Line, Polyline, Polygon, Patho Path is the most versatile, accepting a Geometry object which can represent any shapeo it is easiest to create shapes using Expression Blend
    38. 38. graphicstransformso FrameworkElement has a RenderTransform  property which can be assigned to: o TranslateTransform (move) o ScaleTransform o RotateTransform o SkewTransform o CompositeTransform (combine any of the above)o additionally, the Projection property allows creating 3D-like effects
    39. 39. graphicsanimationso animate dependency property using a Timeline  that fits the property type: o DoubleAnimation, ColorAnimation, PointAnimationo use Storyboard to group a few animations togethero use an easing function to make the animation look more “real” (e.g. to add elasticity)o it‟s easiest to create storyboards in xaml and in Expression Blend
    40. 40. demoanimations
    41. 41. resources o silverlight toolkit prism project rosetta (tutorials) Introducing Expression Blend 4
    42. 42. break
    43. 43. WINDOWS PHONE
    44. 44. windows phone o application structureo phone-specific controlso sensors and services
    45. 45. application structurefileso App.xaml: application entry point. contains  global resources, services, events (startup, shutdown, etc.) and instantiates PhoneApplicationFrameo WMAppManifest.xml: contains application deployment information: capabilities, tasks, icon.o MainPage.xaml: a PhoneApplicationPage that contains the main view of the application.
    46. 46. application structuredefault control treeo PhoneApplicationFrame  o PhoneApplicationPage o Grid named “LayoutRoot” o StackPanel named “TitlePanel” o TextBlock named “ApplicationTitle” o TextBlock named “PageTitle” o Grid named “ContentPanel” o <your content goes here>you can clear the entire pagecontent and write your own, but formost apps it is recommended tostay within the „metro‟ guidelines
    47. 47. application structurenavigationo web browser like: each page can be navigated  to using the NavigationService by passing a URI o the PhoneApplicationFrame can only display a single page at a time!o the hardware back button can be used to go back to the previous page on the stacko you can pass data to the page using URI query or by placing it in a globally known location (such as the App class)
    48. 48. application structuretombstoningo windows phone can only run one application at a  time. so, each time you switch to another application, the current one gets terminated – i.e. tombstonedo your app will get tombstoned if: o you click the start button o you get a call while the app is running o the phone gets locked o the app uses a launcher or a chooser (e.g. use the camera)o you can use the app‟s Activated and Deactivated events to handle tombstoning
    49. 49. application structureapplication baro preferred menu system for  your appso up to 4 buttons, monochrome 62x62 bitmaps o add a button from Blend to get some default bitmaps o get more from http://thenounproject.como add up to 5 menu items
    50. 50. demoapplication bar
    51. 51. phone controls o most of silverlight‟s controls have been adjusted to windows phone, supporting touch and templated to the phone‟s theme o while some controls such as ComboBox and ToolTip exist on the phone, their use is discouraged
    52. 52. phone controlspanorama and pivoto panoramic applications  offer a unique way to view controls, data, and services by using a long horizontal canvas that extends beyond the confines of the screen.o pivot can be used for filtering large datasets, viewing multiple data sets, or switching application views.
    53. 53. demopanorama & pivot
    54. 54. sensorsaccelerometero measures acceleration forces such as gravity  or the forces caused by moving the sensor o can tell the direction of the earth relative to the phoneo use the Accelerometer class to access the sensor o this sensor reports a constant value in the emulator, so it is recommended that you mock its values for testingo possible uses: responding to phone movements in games, bubble levels, etc.
    55. 55. sensorsgeo-location o obtain the current location of the phone using the GeoCoordinateWatcher classo you can get the latitude, longitude, altitude and current speed of the deviceo this sensor is not available in the emulator. use the GpsEmulator project, available at app hubo use the Bing maps control to display a map of the current location
    56. 56. sensorscamera o obtain photos from the camera using the CameraCaptureTask choosero get a Stream from the chooser and create a BitmapImage from ito the emulator will provide a simple black- and-white image to capture
    57. 57. servicespush notificationso allows applications to receive updates in the  background (app doesn‟t need to be running!)o three types of notifications: o toast – when app is inactive o tile (background, title, count) o raw – directly to the appo you need to create a compatible web service
    58. 58. what‟s newin version 7.5 (aka “mango”)o internet explorer 9 o SQL CE: in-memory local SQL databaseo multi-tasking and live agentso silverlight 4o raw camera feed accesso tcp/ip socketso better developer toolso beta sdk shipping this month
    59. 59. resources o Programming Windows Phone 7 by Charles Petzold (free ebook) Windows Phone 7 Developer Guide quickstarts the noun project (icons for your app)
    60. 60. break
    62. 62. marketplaceadvantages o integrated into the phone o use the zune software to browse on the PCo free or paid apps with a trial optiono downloads, updates and payments are managed for youo free registration for students using DreamSpark
    63. 63. marketplacesteps  develop submit certify & debug & validate & sign windows phone application marketplace deployment service
    64. 64. marketplacebest practices o make it appealing (use metro!)o make it stable and reliableo make it original and usefulo make it easy to useo read the certification requirements carefully o test your app as suggested to avoid common certification pitfalls
    65. 65. marketplacein lithuania o currently not supported directly in App Hubo use a third-party broker: appa market / yalla appso as a student, you get 100 credits which you can use to: o upload apps o unlock devices for development
    66. 66. resourceso certification requirements  dreamspark yalla apps appa market best practices for application marketing US/home/about/app_submission_walkthrough_application_marketing
    67. 67. thank you!