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

Developing on Windows 8

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

Consultez-les par la suite

1 sur 42 Publicité
Publicité

Plus De Contenu Connexe

Les utilisateurs ont également aimé (17)

Publicité

Similaire à Developing on Windows 8 (20)

Plus récents (20)

Publicité

Developing on Windows 8

  1. 1. Developing on Windows 8 Power point template by Colin Eberhardt
  2. 2. Agenda WinRT Platform Basics Best practices Pickers Contracts Tiles Notifications
  3. 3. Who am I Einar Ingebrigtsen @einari einar@dolittle.com http://blog.dolittle.com http://www.ingebrigtsen.info
  4. 4. The target
  5. 5. Old school interop
  6. 6. Windows RT style
  7. 7. Architecture
  8. 8. Bridging the gap FileOpenPicker picker = new FileOpenPicker(); picker.FileTypeFilter.Add("*")a; StorageFile file = await picker.PickSingleFileAsync(); Windows.Storage.Streams.IInputStream inputStream = await file.OpenReadAsync(); System.IO.Stream stream = inputStream.AsStreamForRead(); System.IO.StreamReader reader = new StreamReader(stream); string contents = reader.ReadToEnd();
  9. 9. Missing things Reflection API changed Type details through GetTypeInfo() – extension method Emit namespace practically empty - security
  10. 10. XAML Originally developed for Windows Vista and exposed as WPF Defines what you see Layout is by default not flowing, as in HTML Can observe changes (Active View)
  11. 11. Tools
  12. 12. Binding Source Defaults to DataContext Can use StaticResource as source Mode OneWay, TwoWay, OneTime – OneWay default Validation ValidatesOnException ValidatesOnNotifyDataErrors INotifyDataErrorInfo
  13. 13. Binding StringFormat StringFormat = „MMM.dd.yyyy‟ Null and Fallback values TargetNullValue=„(None)‟ FallbackValue=„(Data Context Not Set)‟ IValueConverter
  14. 14. Element to Element Can bind directly to other elements properties Binds by name of element
  15. 15. Events You still have events as before – buttons can be clicked and raise an event RoutedEvents – bubbles through the UI
  16. 16. Async var data = DownloadData(...); ProcessData(data); STOP DownloadData ProcessData var future = DownloadDataAsync(...); future.ContinueWith(data => ProcessData(data)); DownloadDataAsync ProcessData
  17. 17. Async Models Windows Runtime : IAsyncOperation<T> .NET Framework : Task<T> C# 5.0 – async / await
  18. 18. Async – C# style Marked with “async” modifier Must return void or Task<T> Use “await” operator to cooperatively yield control – remember to mark with “async” Feels just like good old synchronous code
  19. 19. Patterns & Practices MVVM Inspired by PresentationModel by Martin Fowler Good for decoupling – promotes testability Compositioning Commands Actions / Triggers / Behaviors
  20. 20. MVVM Model View Observes ViewModel Observable
  21. 21. Compositional UIs Navigation Header Main Content Footer
  22. 22. Event Aggregator ViewModel 1 ViewModel 2 Aggregator
  23. 23. Tiles Tap on tile to launch or switch to an app Static default tile specified in app manifest Two sizes: Both sizes can have live updates
  24. 24. Live Tiles Tiles updates using Templates provide Text-only image-only pre-defined templates rich rendering options or combination JPEG or PNG only, max size 150 Optional “peek” Local or cloud KB animation updates
  25. 25. Notification Queuing
  26. 26. Secondary Tiles
  27. 27. Windows Notification Service Enables delivery of tile and toast notification over the internet Tile updates and notifications shown to the user even if your app is not running WNS handles communication with your app Scales to millions of users WNS is a free service for your app to use
  28. 28. Push Notification Overview 1. Request Channel URI 2. Register with your Cloud Service 3. Authenticate & Push Notification
  29. 29. Toast Notifications Toast notifications deliver transient messages outside the context of the app Use toast notifications to get user‟s attention immediately User is in control and can permanently turn off toast notifications from your app Allows quick navigation to a contextually relevant location in your app Toast notifications are easy to invoke from your app or from the cloud
  30. 30. Toast Templates Uses same template architecture as Live Tiles Rich set of rendering options available
  31. 31. Contracts Contracts enable integrating the Windows 8 experience into your app Yields a consistent UI for all apps
  32. 32. Search Enables your app to interact and respond to Suggestions Search Query
  33. 33. Settings Consistently given one place to get search Context sensitive to the front facing app
  34. 34. Share Your app can share anything (text, images, binaries) Automatically filters available applications to share to Your app can be a share target – receive sharing from others Add sharing target as a capability and you can receive share requests
  35. 35. Play To Ability to stream media to compatible devices
  36. 36. Summarized Windows RT is a huge leap, both in faith but also technically Consistent API that feels mature from day one Well architected solutions putting the user first Makes us as developers focus on adding the business value
  37. 37. Resources The samples of today http://github.com/einari/toodeloo Yggdrasil – IoC Container http://github.com/dolittlestudios/yggdrasil https://nuget.org/packages/Yggdrasil INPC Weaver http://github.com/SimonCropp/NotifyPropertyWeaver WinRT Toolkit http://jupitertoolkit.codeplex.com Tiny IoC container - WinRT Compatible http://microsliver.codeplex.com/
  38. 38. Resources MVVM Light http://mvvmlight.codeplex.com/ Setting up push notifications – registering your app https://manage.dev.live.com/build WAT for Windows 8 + WnsRecipe http://watwindows8.codeplex.com/releases/view/73334 Calisto – UI Framework for WinRT https://github.com/timheuer/callisto Get into the store – register as a deveveloper http://msdn.microsoft.com/en-us/windows/apps/
  39. 39. Thanks for your attention

Notes de l'éditeur

  • Visual Studio : Code editor w/ IntellisenseUI Designer DebuggersSimulator Platform window Blend : Code editor WYSIGYG designer Animation Better properties window SimulatorPlatform window
  • Metro App = one foreground full screen window that allows the user to work more efficientlyThe other Metro Apps are quickly suspended to preserve battery lifeAs a developer, you have to know how Windows manages your App lifetime and how to be a good citizenApps are suspended 5 seconds after leaving foreground.However, you get 10 seconds instead when you switch from one App to another.You can check it if you launch an App in Snap view and keep the Task Manager in the Filled view (I’m not able to find a workflow that ends up to the 5 seconds…)
  • Metro App = one foreground full screen window that allows the user to work more efficientlyThe other Metro Apps are quickly suspended to preserve battery lifeAs a developer, you have to know how Windows manages your App lifetime and how to be a good citizenApps are suspended 5 seconds after leaving foreground.However, you get 10 seconds instead when you switch from one App to another.You can check it if you launch an App in Snap view and keep the Task Manager in the Filled view (I’m not able to find a workflow that ends up to the 5 seconds…)

×