Please
Windows Runtime APIs
 Available to all programming
languages
JavaScript
 Requires a language neutral
type system
Windows
Runtime
C++
C#/VB
4
Basic Types
INT32, UINT64
Most basic types supported
Strings
HSTRING
Avoids copying in multiple languages
Structures
struct Rect;
Can contain strings, but not interfaces
References
IInspectable
All classes, methods, properties and
events are modeled using interfaces
Simple Arrays
INT32 []
For very basic collections
Events
event T^ Signaled;
Modeled as interface
Collections
IVector<T>
Type-generic interfaces
public ref class
__int64
sealed
property __int64
__int64
void
__int64
bool
__int64
return
__int64
return
var
var
var
var
new
// true
// false
Basic Types
INT32, UINT64
Most basic types supported
Strings
HSTRING
Avoids copying in multiple languages
Structures
struct Rect;
Can contain strings, but not interfaces
References
IInspectable
All classes, methods, properties and
events are modeled using interfaces
Simple Arrays
INT32 []
For very basic collections
Events
event T^ Signaled;
Modeled as interface
Collections
IVector<T>
Type-generic interfaces
public ref class
sealed
nullptr
property
return
void
var
// What is the value of ‘s’?
null
var
// What is the value of ‘s’?
var
// What is the value of ‘s’
Basic Types
INT32, UINT64
Most basic types supported
Strings
HSTRING
Avoids copying in multiple languages
Structures
struct Rect;
Can contain strings, but not interfaces
References
IInspectable
All classes, methods, properties and
events are modeled using interfaces
Simple Arrays
INT32 []
For very basic collections
Events
event T^ Signaled;
Modeled as interface
Collections
IVector<T>
Type-generic interfaces
using namespace
public ref class
sealed
property
return
void
b.myBounds = { x: 100, y: 200, width: 300, height: 400 } ;
b.myBounds.width = 42;
// What is the value of ‘width’?
b.myBounds = { x: b.myBounds.x,
y: b.myBounds.y,
width: 42,
height: b.myBounds.height };
var bounds = b.myBounds;
bounds.width = 42;
// What is the value of ‘b.myBounds.width’?
Basic Types
INT32, UINT64
Most basic types supported
Strings
HSTRING
Avoids copying in multiple languages
Structures
struct Rect;
Can contain strings, but not interfaces
References
IInspectable
All classes, methods, properties and
events are modeled using interfaces
Simple Arrays
INT32 []
For very basic collections
Events
event T^ Signaled;
Modeled as interface
Collections
IVector<T>
Type-generic interfaces
Basic Types
INT32, UINT64
Most basic types supported
Strings
HSTRING
Avoids copying in multiple languages
Structures
struct Rect;
Can contain strings, but not interfaces
References
IInspectable
All classes, methods, properties and
events are modeled using interfaces
Simple Arrays
INT32 []
For very basic collections
Events
event T^ Signaled;
Modeled as interface
Collections
IVector<T>
Type-generic interfaces
public ref class
void
sealed
var arr = { 1, 2, 3, 4, };
b.ArrayMethod (arr);
// What is the value of arr[0]?
b.ArrayMethod2(arr);
// What is the value of arr[0]?
Basic Types
INT32, UINT64
Most basic types supported
Strings
HSTRING
Avoids copying in multiple languages
Structures
struct Rect;
Can contain strings, but not interfaces
References
IInspectable
All classes, methods, properties and
events are modeled using interfaces
Simple Arrays
INT32 []
For very basic collections
Events
event T^ Signaled;
Modeled as interface
Collections
IVector<T>
Type-generic interfaces
public ref class SignaledEventArgs sealed
public delegate void SignaledEventHandler
Object
SignaledEventArgs
public ref class
sealed
event SignaledEventHandler^
var
new
b.addEventListener ("Signaled", function () { … });
// What just happened?
b.addEventListener ("signaled", function () { … });
b.onSignaled = function () { … };
// What just happened?
b.onsignaled = function () { … };
Basic Types
INT32, UINT64
Most basic types supported
Strings
HSTRING
Avoids copying in multiple languages
Structures
struct Rect;
Can contain strings, but not interfaces
References
IInspectable
All classes, methods, properties and
events are modeled using interfaces
Simple Arrays
INT32 []
For very basic collections
Events
event T^ Signaled;
Modeled as interface
Collections
IVector<T>
Type-generic interfaces
public ref class
sealed
var
// What just happened?
var
// What just happened?
var
// What just happened?
var
// What just happened?
C++ language extension summary
The Windows Runtime
Windows Runtime Design
http://forums.dev.windows.com
http://bldw.in/SessionFeedback
Descargar

PLAT-876T: Lessons learned designing the Windows Runtime