Radu vunvulea building and testing windows 8 metro style applications using c++,c# and java script
-
Upload
radu-vunvulea -
Category
Technology
-
view
980 -
download
0
description
Transcript of Radu vunvulea building and testing windows 8 metro style applications using c++,c# and java script
Building and testing Windows 8 Metro Style Applications using C++,C# and JavaScript
Radu [email protected]
http://vunvulearadu.blogspot.com
{“name” : “Radu Vunvulea,“company” : “iQuest”,“userType” : “enthusiastic”“technologies” : [ “.NET”, “JS”, “Azure”, “Web”, “Mobile”, “SL” ],“w8experience” : [ “2 LoB App”, “1 Travel App”],“blog” : “vunvulearadu.blogspot.com”,“email” : ”[email protected]”,“socialMedia” :
{“twitter” : “@RaduVunvulea”,
“fb” : “radu.vunvulea”}
}
Who am I?
• WinRT• Windows 8 Architecture I• WinMD• Windows 8 Architecture II• Windows 8 Profiles• Mixing Components• Extensibilities points • Unit tests• Windows 8 App Package
Agenda
•WinRT•WinMD• Chakra• Windows Kernel Service• Windows Runtime API• CLR, CRT, WinJS
•WinRT•WinMD• Chakra• Windows Kernel Service• Windows Runtime API• CLR, CRT, WinJS
• WinRT – Windows Runtime• Allow us to build app that use Windows functionalities• We can use any kind of language (managed or not)
• C#• C++• JavaScript• Visual Basic
• Language projection for any kind of language• Expose Windows functionalities • Native for any supported language
What exactly is WinRT
• WinRT – Windows Runtime• Allow us to build app that use Windows functionalities• We can use any kind of language (managed or not)
• C#• C++• JavaScript• Visual Basic
• Language projection for any kind of language• Expose Windows functionalities • Native for any supported language
What exactly is WinRT
• We don’t need to use COM and Win32 anymore – for “Metro Apps”
• Easy access to Windows features• Object lifetime management • Same API on different languages• A lot of things are supported by default, we don’t need to
write code for that:• Image capture• IO access• Geolocation• Contracts• Networking• … and so on
Why WinRT is good
• We don’t need to use COM anymore• Easy access to Windows features• Object lifetime management • Same API on different languages• A lot of things are supported by default, we don’t need to
write code for that:• Image capture• IO access• Geolocation• Contracts• Networking• … and so on
Why WinRT is good
• WinMD – Windows Metadata• Describe what a WinRT component can do• Separate file, not included in the WinRT file• Compatible metadata - .NET ECMA-355 (not IDL)
• This is the secret which make it possible a WinRT object to be consumed by - native C++ - managed C# - JavaScript using Chakra JS Engine
What about WinMD
Windows 8 and WinRT architecture
Windows 8 and WinRT Architecture
• Only one CLR for all application (desktop and “Metro Apps”)• Different instances for desktop and “Metro Apps”• Only one IL for all applications (desktop and “Metro Apps”)• Only one MSIL for all applications• The same .NET Framework 4.5 is used for all applications,
but it used different profiles• .NET Client Profile – desktop• .NET Metro Profile – “Metro Apps”
• Framework contains rules that define what parts are available for each profile
Windows 8 and WinRT Architecture
Windows 8 Profiles
.NET
Silverlight
Windows Phone
Windows 8 Apps
.NET
• JavaScript with HTML 5 and CSS+ Well Known+ IndexdDB+ Dynamic language- WinRT not fully available
• C# with XAML+ Full access to WinRT + some custom libraries+ async/await, async calls supported at language level+ Component written for SL or WP7 can be reused+ Well known- XAML can be a hell sometimes
• C+++ Very fast+ DirectX (games)
What should I use?
How to mix different components
C# C++
Java Script
How to mix different components
C# C++
Java Script
It is not possible
• .WinMD describes all the public API exposed by the component
• For JavaScript, the system will manage the class instances• We don’t need to configure the project that will generate
the shared component
• Be aware that you cannot have/use• XAML controllers in a Java Script app• Java Script components in a XAML/C# project
• Even if we have a WebView, we don’t have full access
• We can have a C# component that use XAML and use it in a C++ application that use DirectX
How to mix different components
• Our class that will be exposed have to:• Be sealed • Be public• No virtual• The class should not be empty• The class should not be abstract• All the input and output of collection types need to be
interfaces (IList)• Interfaces are not supported in this moment to be
exposed• Windows.Foundation.Metadata.DefaultOverload– for overloading
How to create reusable C# components
• Asynchronous calls are supported• An asynchronous call need to return an
IAsyncOperationTReturn>• We can obtain it calling “AsAsyncOperation()” method.
• A Task<T> is automatically converted into Promise• Don’t forget to named your method accordingly • Any method that’s take longer than 50ms
How to create reusable C# components
Demo
• It is an important feature for LoB applications
• Dynamic components loading (reflection)• JS loaded and compiled at runtime
• MEF (Managed Extensibility Framework)• Prims
What about extensibility…
• It is an important feature for LoB applications
• Dynamic components loading (reflection)• JS loaded and compiled at runtime
• MEF (Managed Extensibility Framework)• Prims
• Non-official response• Wait, have patience, in 6-9 months we may have
something for you
What about extensibility…
Demo
• For code written in C/C++, C# and Visual Basic we have build in support for unit tests
Unit tests
• For code written in C/C++, C# and Visual Basic we have build in support for unit tests
• What about Java Script? • Should we write unit tests for it? • Can I run unit tests from Visual Studio 2012? • Can I integrate Java Script unit tests to the build
machine?
Unit tests
• For code written in C/C++, C# and Visual Basic we have build in support for unit tests
• What about Java Script? • Should we write unit tests for it? YES• Can I run unit tests from Visual Studio 2012? YES• Can I integrate Java Script unit tests to the build
machine? YES
• There are a lot of frameworks and plugins for this:• Chutzpah Test Adapter for Visual Studio 2012• QUnit
Unit tests
Demo
• A package contains all the files that are required by our application to run
• An update of our app represent a new version of package that contains all the files (not the delta)
• Each package is sign by the author using a unique key• A package can be created using
• Visual Studio• MakeAppX.exe (command line)
Windows 8 App Package
• Every package contains a Package Manifest
• Package Manifest:• Package identity
(package name, version, publisher, processor architecture, resource ID)
• Package propertiesinformation about package
• Capabilitiesa list of application capabilities
• Extensionsused to communicate with system and other application
• Visual elementsdefault tile, logo images, background color, and splash screen
Windows 8 App Package
• Each package contains a Power Shell script• A normal user can install a package only from Marketplace• Using a developer account any package can be installed on
a computer (even the packages that are not signed)
• Corporate devices – Windows 8 Enterprise• Windows 8 App packages that can be pushed from the
corporate network without the need to publish the application on the Marketplace.
Windows 8 App Package
Demo