Kinect Status Notifier – Notify Kinect Status in System Tray August 8, 2013Posted by Abhijit Jana in CodePlex, Kinect, Kinect for Windows SDK.
Tags: CodePlex, Kinect, Kinect for Windows SDK, Kinect for Windows SDK Programming Guide, Status Notifer
The Kinect Status Notifier, will pops up a notification in system tray whenever this changes in sensor status. This can be very useful for Kinect for windows SDK based application.
To understand the flow of the Kinect status and the scenarios on which it can occur in a simpler way, refer the diagram below. Once the device is plugged in and power is turned off it will goes to “Not Powered” state, similarly for unplugging the device from USB port will returns the “Disconnected” status. If you plugged it in back or turn the power on, first it will in “Initializing” state before turns into “Connected” state.
Read more about Kinect Status over here
Kinect for Windows SDK V1.0 or Higher
Kinect for Windows Sensor
See it in action
Kinect Status Notifier, will notify the state of the sensor whenever there is a change of status.
By default, it shows the Kinect Status and device Id during the notification. You can customize the messages based on your requirements.
What is inside ?
KinectStatusNotifier is not a self-executable, it generates an assemblies “KinectStatusNotifier.dll” which can be used with Kinect based application. NotifyIcon is utility forms System.Windows.Forms which can be used invoke the default notification from the system tray. By default, WPF application does not have the Notify Icon, so we are going to create a wrapper around System.Windows.Forms.NotifyIcon so that we can easily invoke it from WPF application.
How to use it ?
1. Add the “KinectStatusNotifier.dll” as reference assembly to the Kinect for Windows Application. Or you can install it using Nuget Package
2. Add the below namespaces in the application
3 Instantiate a new object for StatusNotifier class as shown below
private StatusNotifier notifier = new StatusNotifier();
2. Assign the KinectSensor.KinectSensors collection reference to notifer.Sensors
this.notifier.Sensors = KinectSensor.KinectSensors;
Now, whenever there is change in status change, you can see the notification with the current Status in System tray icon.
You can set the AutoNotification to false, which will stop the automatic notification in system tray from StatusNotifer and invoke the notify tray icon explicitly when there is a status change by handling StatusChanged event handler in your application itself.
You can also handle it both the places, but can notify status in tray icon from a single place.
Project Download and Source Code
This utility is a sample project from my book, Kinect for Windows SDK Programming Guide. If you want to learn more about how to build application using Kinect for Windows SDK, please check my book out. Thanks