DCSIMG
September 2011 - Posts - Windows DEV ices DEV
Sign in | Join | Help

Windows DEVices DEV

Elad Shaham's Blog

September 2011 - Posts

The Basics of WinRT in Windows 8

Windows8-metroSo this is the first post that I’m writing in my brand new Windows 8 Developer Preview Samsung Tablet. One of the important concepts that have been introduced in the BUILD conference is the introduction of WinRT, the new runtime layer on top of which new apps can be written in the supported languages – .NET, JavaScript and C++.

WinRT exposes a set of libraries which can be used by any of the above languages. WinRT is supposedly the Win32 replacement, so it covers most of the more important capabilities Win32 covers. The main difference between the two is the way you access the API. WinRT exposes a set of classes, rather then functions in Win32, which you can access in an Object Oriented way in any of the supported languages. Each language got its own built in adapter layer for the WinRT API, so using classes from the WinRT layer is basically a matter of importing the correct namespaces.

One nice example of a WinRT class is the FileOpenPicker. It lives under Windows.Storage.Pickers namespace, and it’s practically the new way of opening files in Windows 8.

Windows-8-file-picker

Another very nice thing you could do is create a custom WinRT library in one language and reference it in project created in another language. So you can import a project written in C++ for example and reference it in a .NET project. One would argue that this could be done years ago using COM, but in fact with WinRT this process is so much simpler.
All you need to do in the exported project is change the project output type to WinRT (in project properties) and follow the following guidelines:

  1. API signatures must only use Windows Runtime Types
  2. Structs can only have public data fields
  3. Inheritance can only be used for XAML controls, all other types must be sealed
  4. Only supports system provided generic types

I hope to try and cover some more of the built in WinRT libraries in the next posts.

My Impressions from BUILD Keynote

IMG_20110913_084323I have the pleasure of participating in the BUILD conference in Anaheim, CA, together with 18 of my Sela colleagues. The keynote ended about one hour ago – Meet Windows 8. I know there are already hundred of blog posts regarding what has been said in the keynote presentation, but I wanted to share what I find most important.

First of all, the user interface looks amazing!!! Being very fond of Windows Phone user interface, and after a few attempts by Microsoft to provide a full touch experience in the previous versions of Windows, I believe they finally got it right. They took all the successful elements of the Metro user experience, together with a few successful ideas from the Android OS, and implemented a very intuitive experience for tablet PCs.

IMG_20110913_091512

If you are already developing apps for Windows and Windows phone, you’ll be happy to hear that your legacy apps should work flawlessly with Windows 8, but if you really want to integrate your app into the rich Windows 8 experience, you’ll probably need to do some work. .NET, Silverlight, C++ and HTML (not necessarily in that order) will continue to be the programming languages in the Windows environment.

Onc of the things I like the most is the ability of apps to communicate with each other. One application could indicate that it want to integrate into the built in search mechanism, and from this point forward, whenever the user searches anything this app could be a search provider. Furthermore, if you need to share something from within your app - for example send the selected text to an email recipient - the system can popup a small frame which lets your complete the task without actually leaving your app. This is all achieved by the Charms menu, a popup menu that can be launched by sliding your finger from the right side of the screen to the left.

IMG_20110913_092228

We saw how easy it is to write code on top of the new WinRT native (I guess we’ll have many sessions about it), and I must say it looks very impressive. We also got a quick peek at the new Visual Studio 2011 and Expression Blend 5.

IMG_20110913_094717

Finally, later on tonight all of the BUILD conference participants will be the pride owners of a new Windows 8 Samsung tablet…

IMG_20110913_102843

Stay tuned…