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

Develop an app for Windows 8 using HTML5

Chargement dans…3

Consultez-les par la suite

1 sur 72 Publicité

Plus De Contenu Connexe

Diaporamas pour vous (20)

Similaire à Develop an app for Windows 8 using HTML5 (20)


Plus récents (20)

Develop an app for Windows 8 using HTML5

  1. 1. AGENDA
  2. 2. I’m a Web developer, I don’t know (at all) Microsoft technologies. I already developed an HTML5 web page. I want to create the Windows 8 app of my page.
  3. 3. My existing web page: home.dollon.net
  4. 4. Compatible with all last browsers on PC and tablets. Works with HTML5 and CSS3 features, knockout.js, jQuery, less (and node.js web service)
  5. 5. DEMO
  6. 6. So now, please Microsoft, where is the right button click “Transform this website as a metro style app for Windows8”?
  7. 7. It does not exist. And it’s normal. Because you are working for a specific kind of tablet with native call (new API, new controls…) and NEW design style (metro). You are not designing a web page. You are developing a native app.
  8. 8. 9 things to migrate your HTML5 app on Windows 8 environment.
  9. 9. 0 – which kind of tools I need?* *this point is not included on the counter ☺
  10. 10. DEMO
  11. 11. 1 - what is a package?
  12. 12. a package is a ZIP file Don’t forget to obfuscate your code It’s the ‘executable’ of your project It contains everything (HTML, JS, Manifest..) After installation, the app is located here c:Program FilesWindowsApps
  13. 13. You can use PowerShell to deploy it And all packages are signed with certificates
  14. 14. 2 – what happens in runtime?
  15. 15. The process that hosts/executes a Metro style app using JavaScript is called WWAHost.exe Your app ‘live’ inside a sandbox without all privileges of the current user
  16. 16. Process state transitions A user App is launch an Suspended Terminated running app An app gets 5 secondes to handle suspend and is notified when it has been resumed App is not notified before a termination caused by low resources
  17. 17. 3 – Differences between Metro style app And traditional HTML5 web page
  18. 18. ALL* HTML5/CSS3 features are supported *if IE10 “trident” layout engine support it
  19. 19. ALL* JavaScript features are supported *if IE10 “Chakra” engine support it
  20. 20. Native APIs DOM Events Namespaces Controls Enumerations No Java, Silverlight, Flash and other embedded components Some ActiveX controls are disabled
  21. 21. So, HTML5, CSS3 and JavaScript have the same support of web APIs than IE 10 + API from WinRT
  22. 22. And you have to know that seriously ROCKS!
  23. 23. This isn’t just a container like PhoneGap It doesn’t run in a browser
  24. 24. REUSE THE SAME CODE Just to see if it works ☺
  25. 25. 4 – what is WinRT?
  26. 26. Windows RT != WinRT (Windows RT is the Windows 8 version for ARM)
  27. 27. WinRT Resides directly on the top of the kernel just like the Win32 API WinRT APIs are written in unmanaged C++ and designed to be object-oriented
  28. 28. 5 – what is WinJS?
  29. 29. WinJS is the orange layer
  30. 30. A language projection exists for .NET and C++ too
  31. 31. Windows library for JS Helpers Animations Templates Styles App Model Data Binding Controls Navigation
  32. 32. Binding.js Wwaap.js Ui.js Base.js Controls.js Animation.js
  33. 33. 6 – Windows Controls
  34. 34. Built-in Controls Metro-UI Styles Touch enabled Native Customizable All basic controls Controls Same in XAML
  35. 35. AppBar Useful to bring up commands on demand Don’t forget to use Charms for some entry points
  36. 36. MODIFY THE APP With Windows 8 controls
  37. 37. 7 – Multiple Views and Resolutions
  38. 38. The principal screen can be at minimum 1024x768 It exists widescreen (1366x768+) Two other modes: snapview and portait
  39. 39. Use three kind of image size (100%, 140% and 180%). Depending on the resolutions, images are loaded automatically Image.jpg Image.scale-180.jpg
  40. 40. Use of CSS media queries
  41. 41. MODIFY THE APP Screens
  42. 42. 7 – Use Contracts
  43. 43. Share to export the current content Search to find content File Picker to allow user to access content from outside Settings to configure the app
  44. 44. MODIFY THE APP Contracts
  45. 45. 8 – Use Tiles
  46. 46. Tiles is the “link” to open your app It could be a “secondary tiles” Can provide a lot of information (icons, notifications, counter)
  47. 47. MODIFY THE APP With Tiles and Splash
  48. 48. 9 – Debugging and Performances
  49. 49. Performance Tips & tricks that still work: For safe dynamic content, use innerHTML Link CSS stylesheets at the top of the page Avoid inline JavaScript and inline CSS styles Don’t parse JSON by hand, use JSON.parse
  50. 50. A Metro style app using HTML5 is more than a web page …
  51. 51. Optimize your landing page Rely on packaged content and local data Use local images scaled to the right size Use WinJS fragments to load parts of your app on demand Defer parsing of unneeded HTML content Delays JavaScript Keeps your DOM small: look-up and manipulations are quicker
  52. 52. Further optimizations Defer some initialization to after the splash screen Start network downloads after initialization Delay loading databases Consolidate small JS files that are related into larger files If you need more time, use an extended splash screen
  53. 53. Manage your resources Keep a lightweight DOM Release expensive content, such as media elements, as soon as they are no longer needed Help the garbage collector Avoid circular references between your elements and JavaScript code Review how you use your Object URLs
  54. 54. On suspend, free resources that are easy to recreate Use media content from the user at the screen resolution Tune your app launch time to create great first impressions Keep your app alive by minimizing your memory footprint Be responsive, don’t block the UI thread
  55. 55. Debugging JavaScript apps is !@#$%^ hard!
  56. 56. Debugging with Visual Studio Launch with debugging debugger keyword Debug.enableFirstChanceException(true); JavaScript console DOM explorer
  57. 57. Debugging with Blend Understand your CSS with the Winning Rule and Show Set Properties mode Debug device-state issues with the Platform and Styles Panes Catch grid layout issues Find parser-generated elements with the Live DOM Diagnose post-interaction problems with Interactive Mode
  58. 58. 10 – Deployment But no info now, it still not possible to publish app
  59. 59. Result
  60. 60. Conclusion Skydrive with all samples / slides / videos: http://sdrv.ms/KsoFUq Webcast of this session on YouTube:
  61. 61. Q&A (Don’t hesitate to give us feedbacks on twitter @juliendollon / @soumow)