51
Windows Runtime Deep Dive Brendan Forster Senior Developer, ASP.NET/IIS MVP @shiftkey DEV317

Windows Runtime Deep Dive Brendan Forster Senior Developer, ASP.NET/IIS MVP @shiftkey DEV317

Embed Size (px)

Citation preview

Windows Runtime Deep Dive

Brendan ForsterSenior Developer, ASP.NET/IIS MVP@shiftkey

DEV317

#auteched#dev317

About

What is itHow can you use itWhat’s it doing under the hoodDon’t worry, there are plenty of demos

Audience

People whowork with different languagescare about native codeare curious about internals

You do not need to remember any of this

…but its pretty neat anyway

Windows Kernel Services

JavaScript(Chakra)

C/C++ C#, VB

Windows Store Apps

Communication

& Data

Application Model

Devices & Printing

Windows Runtime APIs

Graphics & Media

XAML HTML / CSS

HTMLJavaScri

pt

CC++

C#VB

Desktop Apps

Win32

.NET SL

Internet Explore

r

Syst

em

Serv

ices

Vie w

Mod

el

Con

trolle

r

Kern

el

DX

Windows Kernel Services

JavaScript(Chakra)

C/C++ C#, VB

Windows Store Apps

Communication

& Data

Application Model

Devices & Printing

Windows Runtime APIs

Graphics & Media

HTML / CSS

HTMLJavaScri

pt

CC++

C#VB

Desktop Apps

Win32

.NET SL

Internet Explore

r

Syst

em

Serv

ices

Vie w

Mod

el

Con

trolle

r

Kern

el

XAMLDX

Windows Kernel Services

JavaScript(Chakra)

C/C++ C#, VB

Windows Store Apps

Communication

& Data

Application Model

Devices & Printing

Windows Runtime APIs

Graphics & Media

HTML / CSS

HTMLJavaScri

pt

CC++

C#VB

Desktop Apps

Win32

.NET SL

Internet Explore

r

Syst

em

Serv

ices

Vie w

Mod

el

Con

trolle

r

Kern

el

XAMLDX

What it is

"Windows Runtime, or WinRT, is a cross-platform application architecture used on the Windows 8 operating system.“

Wikipedia

What it is

In laymans’ terms: use what you want.

Use C#, C++, Javascript for your logicUse XAML or HTML for your UILow-level access to hardware and devices

demo

An introduction to Windows Runtime

What even is it?

Windows Metadata

API specificationDescribe the APIs to consumersCommon Intermediate Language

(the one that .NET assemblies use)

demo

What is Windows Metadata anyway?

“All I see is blonde, brunette, redhead.”

How do we use the metadata ?

Language Projections

Libraries export metadataConsumers parse said metadata Tailor the API to the consumer

because each language has its own weirdness beauty

Windows Metadata & Namespace

Language Projection

Windows Core

Windows Runtime Core

XAML Storage …Network

UI Pickers MediaControls

Windows Store AppLanguage Support (CLR, WinJS, CRT)

Let’s dig a bit deeper

Projecting an array

Array

IInspectableIUnknown

Array

IInspectableIUnknown

IVector<T>

IVectorView<T>

IObservableVector<T>

Array

IInspectableIUnknown

IVector<T>

IVectorView<T>

IObservableVector<T>

C++ AppSTL-style Projection

CLR

C#/VB AppIEnumerable

(T) style Projection

HTML AppCh

akra

JavaScriptProjection

That sounds hard

pffffftt

demo

Write a Windows Runtime Component

How awesome are you? Huh?

A better example

Cartoonify

Take in a image, output a cartoonC++ for the image processingJavascript for the UI

demo

Cartoonify all the things

It needs a better name, seriously…

Let’s go deeper

Windows Metadata & Namespace

Language Projection

Windows Core

Windows Runtime Core

XAML Storage …Network

UI Pickers MediaControls

Windows Store App

Runtime Broker

Language Support (CLR, WinJS, CRT)

Web Host (HTML, CSS, JavaScript))

Your app runs in a sandbox

What?

Process Monitor

WWAHost.exe

Process Monitor

WWAHost.exe

Process Monitor

MyApp.exe

Process Monitor

MyApp.exe

Process Monitor

MyApp.exe

Process Monitor

How does it know?

Package Manifest

Package Manifests<Package> ... <Applications> <Application Id="App" Executable="Billboard.exe" EntryPoint="Billboard.App"> <VisualElements DisplayName="Billboard" … > <DefaultTile ShowName="allLogos" /> <SplashScreen Image="Assets\SplashScreen.png" /> </VisualElements> </Application> </Applications> ...</Package>

Package Manifests<Package> ... <Applications> <Application Id="App" StartPage="default.html"> <Extension Category="windows.search" /> <Extension Category="windows.backgroundTasks"

StartPage="js\app.js"> <BackgroundTasks> <Task Type="controlChannel" /> </BackgroundTasks> </Extension>

</Extensions> </Application> </Applications> ...</Package>

What about permissions?

Runtime Broker

Package Manifests

<Package> ... <Capabilities> <Capability Name="internetClient" /> <DeviceCapability Name="location" /> </Capabilities> ...</Package>

Recap

Use what you want

Use C#, C++, Javascript for your logicUse XAML or HTML for your UILow-level access to hardware and devices

Related Content

Got Questions?

Community Lounge – Thursday/Friday

Speaker Lounge – Thursday 11am

Twitter - @shiftkey

Track Resources

dev.windows.com

channel9.msdn.com/Events/BUILD/BUILD2011/

github.com/shiftkey/auteched2012

github.com/shiftkey/cartoonify

fin

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS

PRESENTATION.