Native Extensions for Microsoft Silverlight (NESL)

If you’re building an application for the Windows platform, you’re probably aware of the new capabilities of Windows 7. Features like the new Windows Taskbar with Jump Lists, the Windows Sensor and Location platform, and, of course, support for rich user interactions through touch – these are just a few of the awesome capabilities of Windows 7 that developers can support in applications today.

For developers building Windows 7 applications with managed code, we have the Windows API Code Pack, a source code library designed to help managed code developers target key features of Windows without forcing them to resort to Platform Invocation Services (P/Invoke) or COM Interop. Moreover, it abstracts all of the heavy-lifting away, leaving you with a clean API for you to target.

Enter Silverlight OOB applications.

When showing the Windows API Code Pack to many developers across Canada, I would get the same question over and over again: How can I target these capabilities of Windows 7 that you’ve shown me, but in Silverlight 4 OOB applications? Until recently, I would answer this question by describing how Silverlight 4 introduced interoperability with local COM components and thus, a means to an end. In other words, a way of getting to these capabilities but not without a great deal of heavy-lifting; indirectly through custom COM automation components and lots and lots of COM interop.

Enter Native Extensions for Microsoft Silverlight (NESL). From the project’s description (with emphasis by me):

Silverlight 4 introduced the ability for Silverlight applications running out-of-browser with elevated trust on Windows to access COM automation components. This in turn made it possible for Silverlight developers to leverage the automation capable Windows platform API’s and object models from application software such as Microsoft Office products in their OOB applications via COM automation.

However, a large majority of the Windows platform API’s today cannot be accessed from Silverlight this way. Some do support COM, but do not support automation; while the others are only accessible through a native language like C or C++.

The Native Extensions to Microsoft Silverlight(NESL) libraries attempt to alleviate this problem by providing COM automation components that act as wrappers over select Windows API’s to make them accessible from Silverlight 4. NESL is an evolving set of libraries, where each phase of the project may add wrappers to additional Windows API’s.

In short, Native Extensions for Microsoft Silverlight provides a mechanism of targeting Windows 7 capabilities like the new Taskbar with Jump List integration, the Windows 7 Sensor API, Windows 7 Speech-to-Text and Text-to-Speech, and much more. Specifically, here are the APIs covered in NESL v1:

Very nice.

Yesterday, NESL version 2.0 Preview Build was made available! Here’s what’s new:

  • New Features
    • Touch Features
      • Gesture support
      • Manipulation processing support
      • Inertia processing support
      • Touch hardware information
  • New Feature Demos for Local Encoding, Portable Devices, Touch and Sensors
  • Bug fixes

Awesome stuff! If you’re building Silverlight 4 OOB applications and you’re looking to target capabilities of Windows 7 then make sure to check out theNative Extensions for Microsoft Silverlight.

Finally, make sure to check out the following resources: