O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required