SilverWii - That is connecting a WiiMote to a Silverlight OOB app via NESL (Native Extensions For Microsoft Silverlight)

Yeah, I know... Silverlight, Silverlight, Silverlight... I know I've been doing a good bit of Silverlight recently, and will back off it soon, but I saw this and well I just couldn't pass this up (I tried, but every time I re-org'ed my list of possible posts this one just kept bubbling all by itself to the top... lol).

Hooking up a Wiimote to a Silverlight app? Come on, you know that's officially "fun"... Smiley

NESL: Native Extension for Silverlight or No (Except Seven) Limits for Silverlight? Experimenting the Sensor API with a Wiimote

The first time I heard about the Native Extension for Silverlight, I wondered: well, in what context can I use this? In what kind of scenario? And overall, is it something really usable? In this article I will try to test one of the features included in NESL, i.e. the capability of interacting with motion sensors. At the end I used the popular wiimote controller since it has a built-in accelerometer. Read the rest of the story to find out the test result.

app_5

..."

What is this NESL project?

Native Extensions For Microsoft Silverlight

"While Silverlight 4 supports accessing COM automation components from elevated trust OOB applications, many Windows platform features are currently not available through COM automation. This makes them inaccessible to such Silverlight OOB apps. Native Extensions for Microsoft Silverlight(NESL) is an effort to incrementally build a library of components that expose select Windows 7 features through COM automation, making them easily available to Silverlight 4 OOB applications running with elevated trust. The current version of NESL provides access to Windows 7 features like Sensors, Portable Devices, Speech, Taskbar and more. NESL is made up of a set of COM automation based runtime libraries, Silverlight wrapper libraries usable from Silverlight 4 OOB applications, sample applications with source, API documentation, and a developer's guide.

NEST v2

  • New Features
    • Touch Features
      • Gesture support
      • Manipulation processing support
      • Inertia processing support
      • Touch hardware information
    • Windows 7 Notification Area (System Tray) support
      • Add/Update/Remove notification icons to the notification area
      • Add/Remove notification information balloons
      • Respond to notification and notification balloon events
      • Add/Update/Remove context menus to notification icons
      • Respond to context menu selections
      • “Minimize to tray”/”Restore from tray”
    • “Single application instance” pattern support
      • Allow only a single instance of the application to run at any time
      • Be notified when a subsequent launch is attempted
      • Aids in applications that add themselves to the system tray, and hence needs to maintain a single running instance.

...

What APIs are covered in NESL v1 ?

It's funny how simple some things can be in hindsight. The hardest part of this entire project is getting the WiiMote connected to your PC. The rest, as you can see in the code, is pretty simple once you harness the power of NESL

SNAGHTML100eb33c

image

The article does a great job in walking you through the code and NEST. Yes, Silverlight 5, with its PInvoke feature, should make stuff like this easier, but today is today and if all you have is Silverlight 4 and need to get a little closer to the hardware, then NESL and this article will be well worth a read.

Summary

In this article we have seen that virtually there are no limits to what Silverlight actually can do; we can even make it speak with a wiimote. The key tool behind that is NESL, a library which provides friendly Silverlight wrapper classes and a runtime which exposes COM automation for most of the features of windows 7 platform. How efficient and practical is this approach? In the article we have tested the NESL Sensors API and the results appear to be encouraging. ...

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
    Unsubscribing
    Subscribing

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.