Developing .NET Windows Forms applications that manage movement

Last reviewed: 10/4/2012

HOW Article ID: H101205

The information in this article applies to:

  • KinectKit

Summary

You can develop .NET Windows Forms applications that manage Kinect sensors using your favorite .NET Windows Forms development tools. This includes development environments such as Microsoft Visual C# .NET, Microsoft Visual Basic .NET, and Embarcadero Delphi Prism.

More Information

KinectKit includes Windows Forms compatible .NET assemblies compiled with .NET Framework V4 and V4.5 to support your application's target framework.

To access the KinectKit .NET classes within your application, add them to your project References:

  1. Within your .NET project, right click on the References folder in C# or Open MyProject in VB and select the References tab.
  2. For .NET V4 applications, add references to the KinectKit .NET assemblies:
    1. Program Files\Chant\KinectKit\Win32\NET\libv4\Chant.KinectKit.dll and
    2. Program Files\Chant\KinectKit\Win32\NET\libv4\Chant.Shared.dll.
  3. For .NET V4.5 applications, add references to the KinectKit .NET assemblies:
    1. Program Files\Chant\KinectKit\Win32\NET\libv45\Chant.KinectKit.dll and
    2. Program Files\Chant\KinectKit\Win32\NET\libv45\Chant.Shared.dll.

To access the KinectKit .NET classes within your application, add references to the KinectKit assemblies in your code:

using System;
...
using Chant.KinectKit;
using Chant.Shared;

Platform Target

Set the project Platform target to either x86 for 32-bit application or x64 for 64-bit application as follows:

Within your C# project

  1. Select the Build tab under project properties.
  2. Select x86 or x64 in the Platform target dropdown list.

Object Instantiation

Declare a global variable for the ChantKM class, instantiate an instance, add the event handler, and set the license and serial properties.

    private Chant.KinectKit.NChantKM NChantKM1;
    public MainWindow()
    {
        InitializeComponent();
        // Instantiate NChantKM object
        NChantKM1 = new NChantKM();
        // Setup event callback handler
        NChantKM1.HasEvent += this.NChantKM1_HasEvent;
        // Set license properties
        NChantKM1.SetStringProperty(ChantStringProperty.CSPLicense, "LicenseRegistrationNumber");
        NChantKM1.SetStringProperty(ChantStringProperty.CSPSerials, "LicenseSerialNumber");
    }

Event Callbacks

Event callbacks are the mechanism in which the component library communications information back to the application such as compilation is complete or there was an error.

    private void NChantKM1_HasEvent(object sender, HasEventArgs e)
    {
        // Get the number of events
        int numberOfEvents = NChantKM1.GetResourceCount(ChantSpeechResource.CSREvent, 0, 0);
        for (int i = 0; i < numberOfEvents; i++)
        {
            // Get the event from the event queue
            NChantKMEvent nChantKMEvent = NChantKM1.GetChantKMEvent(0);
            switch (nChantKMEvent.ChantCallback)
            {
                case ChantCallback.CCKSStatusChanged:
                    {
                        ...
                        break;
                    }
                default:
                    break;
            }
            // Remove the event from the event queue
            NChantKM1.RemoveResource(ChantSpeechResource.CSREvent, 0);
        }
    }

Deployment Checklist

When you are ready to deploy your application, you need to ensure you have a valid license, bundle the correct Chant component libraries, and configure your installation properly on the target system.

Review the following checklist before deploying your applications:

  • You may deploy your .NET application to any system with a valid license from the Chant.
  • Copy Chant.KinectKit.dll and Chant.Shared.dll assemblies to the target system or merge them with your application using an obfuscator like .NET Reactor by Eziriz.
  • Copy NKinectKit.dll to the target system.
  • Register NKinectKit.dll as a COM library on the target system.

Review the following checklist before deploying your .NET Applications targeting Microsoft.Kinect with managed NAPI:

  • You may deploy your .NET application to any system with a valid license from the Chant.
  • Copy Chant.KinectKit.Kinect.dll and Chant.Shared.Speech.dll assemblies to the target system or merge them with your application using an obfuscator like .NET Reactor by Eziriz.

Sample Projects

.NET Windows Forms sample projects are installed at the following location:

  • My Documents\Chant KinectKit\Win32\NET WinForms\VS 2010\CSharp,
  • My Documents\Chant KinectKit\Win32\NET WinForms\VS 2010\Visual Basic,
  • My Documents\Chant KinectKit\Win32\NET WinForms\VS 2012\CSharp,
  • My Documents\Chant KinectKit\Win32\NET WinForms\VS 2012\Visual Basic.

For additional help with KinectKit, contact Chant Support via Chant Support Contacts or web.