Object-Oriented and Modern COM

At its heart, the WinRT provides an object-oriented API to access a wide range of operating system capabilities, aimed at building modern applications. For example, using the webcam from a Windows Store app built in C# looks like this:

using Windows.Foundation;using Windows.Media.Capture;using Windows.Storage;using Windows.Storage.Streams;using Windows.UI.Xaml.Media.Imaging;...public async Task<BitmapImage> TakePictureAsync(){    CameraCaptureUI cameraUI = new CameraCaptureUI();    cameraUI.PhotoSettings.AllowCropping = true;    cameraUI.PhotoSettings.CroppedAspectRatio = new Size(4, 3);    cameraUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Png;    StorageFile file = await cameraUI.CaptureFileAsync(CameraCaptureUIMode.Photo); ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.