Tech ed au 2012 dev212


Published on

My presentation at TechEd 2012

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
  • First part of many parts talking about Windows 8 development here at TechEd
  • Changing World
    User interaction methods

    Piaget’s Theory of Cognitive Development; Sensorimotor stage (birth to 2 yrs) 8-12 months coordination of hand/eye with schemes and intentionality. Logic, means & ends. “First proper intelligence”
    Jean Piaget, Swiss developmental psychologist.
  • The internet
  • In visual studio
  • “Sort of like BCL for Javascript” app development on Windows 8
  • Implemented by jQuery, dojo, node.js, etc.

    Then returns another promise so you can chain them…

    C++ has a similar mechanism through the PPL
  • What are the APIs that we’ve got available to us?

  • We talked about projections already. What we didn’t talk about is the idea that we can author new components in C# and C++.

    These are new WinRT components and we can then consume them in JavaScript/C#/C++ - produces WinMD files that can be consumed anywhere.
  • WinRT is based on COM, interfaces, so doesn’t feel natural in OO lang.

    Projections take care of this so it feels natural.
  • let’s switch gears and talk about where and how these applications run.
  • we’ve already talked about how apps come from a store.
  • The app package (Appx) is abb OPC file ( a zip)

    The package
    It includes anything necessary to deploy or uninstall –
    It includes capabilities and declartions so we know the impact in the system.
    In the package you will see JS files etc. If in C++ see .dll files and what you would expect.
    Blockmap is a series of hashes for each block in your package.
    Combination of signature + blockmap verifies the package.. It can be validated as it comes off-the wire… we don’t have to download the whole thing..

  • and when your app is running, it’s not necessarily making direct API calls to the OS. a lot of APIs are “brokered” and that “broker” decides what to do based on a manifest that’s part of your app.

    There are APIs that we can’t just allow to “happen” without the user’s consent and so your application needs to say what it’s going to try and do and the user needs to be in control of that.
  • The app has to declare what the app wants to do ( capabilities ) which can still be turned down by the user and it also has to declare what it can do on behalf of the operating system or other apps ( i.e. declarations ).
  • this is a huge change and one that developers need to get from day 1.

    the OS is in control of when your app runs. it will definitely suspend it. it may also kill it. you need to code for this from the first line of code that you write.
  • the basics of it.

    Register for events

    Register for time-based;

    Table 1 – Background task trigger events
    Trigger event When the background task is triggered
    ControlChannelTrigger On incoming messages on the control channel.
    InternetAvailable The Internet becomes available.
    InternetNotAvailable The Internet becomes unavailable.
    LockScreenApplicationAdded An app tile is added to the lock screen.
    LockScreenApplicationRemoved An app tile is removed from the lock screen.
    MaintenanceTrigger It’s time for maintenance background tasks.
    NetworkNotificationChannelReset A network channel is reset.
    NetworkStateChange A network change such as a change in cost or connectivity occurs.
    OnlineIdConnectedStateChange Online ID associated with the account changes.
    PushNotificationTrigger A raw notification arrives on the WNS channel.
    ServicingComplete The system has finished updating an application.
    SessionConnected The session is connected.
    SessionDisconnected The session is disconnected.
    SessionStart The user session starts.
    SmsReceived A new SMS message is received by an installed mobile broadband device.
    TimeTrigger A time event occurs.
    TimeZoneChange The time zone changes on the device (for example, when the system adjusts the clock for daylight saving time).
    UserAway The user becomes absent.
    UserPresent The user becomes present.

  • Apps need to store things and especially if they are going to work well online/offline.

    The app can store its own data like settings, files, session, cache etc and we give it isolated space on the disk to do that.

    App has 3 folders – local, temp and roaming. Local is for most things. Temp is for stuff you don’t mind losing.

    However, the user’s data is owned by them and the app has to first ask for the capability to interact with these libraries or take files from the user via the file picker. An app can’t simply open up the user’s photos and start sending them over the internet.
  • App has that 3rd folder called roaming. Subject to size and timing, this data is then roamed to other PCs where the user uses the same Microsoft Account (unless the user chooses not to do this).

    We saw the settings for this in the demo earlier on.
  • App has that 3rd folder called roaming. Subject to size and timing, this data is then roamed to other PCs where the user uses the same Microsoft Account (unless the user chooses not to do this).

    We saw the settings for this in the demo earlier on.
  • Tech ed au 2012 dev212

    1. 1. 00
    2. 2. I really don't want to be a grumpy and bitter developer but #microsoft doesn't make it easy to stay enthusiastic as a #wpf dev. 03.02.2011 @microsoft is king of FUD strategy. causes fear, uncertainty and doubt to devs around the world. pity they do it to *their* own devs #wpf 25.08.2011
    3. 3. not a single mention of #wpf in #bldwin keynote - it's as if it doesn't exist. the XAML thing they talk about is prop closer to #silverlight 12.09.2011
    4. 4. RT @JohnBristowe: Me, attempting to build a Windows 8 app in JavaScript for the past 30 minutes: 09.03.2012 @JohnBristowe that's me today as well :( although all in all JS in Win8 is surprisingly fun :) 09.03.2012
    5. 5. implemented my first 3D transformation animation in CSS yesterday. astonishingly simple. 13.05.2012 it constantly surprises me how easy it is to create fluent animations in HTML/JS in all sort of scenarios. simply not possible in WPF. 22.05.2012
    6. 6. Announcement: (Game Dev Tycoon) is the #win8 game I've been working on the past months. Store review is underway :) 04.07.2012
    7. 7. Announcement: A new NovaMind app is now available on the Windows Store. #mindmapping 27.07.2012 […] I was extremely surprised how pleasant porting code from C# was. JS is also surprisingly fast in IE10. 27.07.2012
    8. 8. Couple of months ago I switched from C# to JavaScript. Surprisingly, I don't miss C# one bit. JavaScript is bloody amazing. 10.08.2012 Using HTML5/JS on WinRT is the most rewarding and productive environment I’ve ever worked with – just now
    9. 9. then then Threadpool Advantages
    10. 10. using Windows.Media.Capture; … async void GetPicture() { var new CameraCaptureUI new Size var await CameraCaptureUIMode if var new BitmapImage await FileAccessMode
    11. 11. JavaScript: Promises handle Async Object that is a promise for a later value Hook up to completion with then() or done () method then(completion, error, progress) then() returns another promise Implementation in base.js: WinJS.Promise Common.js promises/A spec
    12. 12. DllImport "avicap32.dll" "capCreateCaptureWindow" static extern int string int int int int int int int DllImport "avicap32.dll" static extern bool int MarshalAs UnmanagedType ref string int MarshalAs UnmanagedType ref string int // more and more of the same
    13. 13. using Windows.Media.Capture; var new CameraCaptureUI new Size var await CameraCaptureUIMode if var new BitmapImage await FileAccessMode
    14. 14. IReadOnlyDictionary<K,V>IMapView<K,V> IEnumerable<T>IIterable<T> IList<T>IVector<T> IReadOnlyList<T>IVectorView<T> IDictionary<K,V>IMap<K,V>
    15. 15. Windows 8 System manages app lifetimeWindows 7 User manages app lifetime
    16. 16. App gets 5 seconds to work after suspend message Apps are not notified before they are terminated Apps are notified when they have been resumed
    17. 17. <!– Step1: declare control --> <div id=“list” data-win- control="WinJS.UI.ListView" data-win-options="{ selectionMode: 'none' }"></div> /* Step 2: Call WinJS.UI.processAll() */ /* Step 3: Use the control */ document.getElementById(‘list’).winControl.addEve ntListener (‘selectionchanged’, onSelChanged );
    18. 18. Everyday widgets
    19. 19. Presenting data
    20. 20. <!– Step1: declare template --> <div class="itemtemplate" data-win-control="WinJS.Binding.Template"> <div class="item"> <img class="item-image" src="#" data-win-bind="src: backgroundImage; alt: title" /> <div class="item-overlay"> <h4 class="item-title" data-win-bind="textContent: shortTitle"></h4> <div class="item-subtitle" data-win-control="WinJS.UI.Rating" data-win- options="{disabled: true}" data-win-bind="winControl.userRating: rating"></div> </div> </div> </div> /* step2: use the Data Template */ ui.setOptions(listView, { oniteminvoked: this.itemInvoked });
    21. 21. Commanding surfaces