I am trying to create an Interface for use with the Windows Kinect using C#. I have been able to implement everything so far and the gesture movement works perfect using the hand cursor. I then had the task of implementing Voice recognition into the program so the user can also give the program voice commands alongside with using gestures. The problem is within my Window_Loaded method, I have placed a sensor.Start(); and sensorChooser.Start(); within the method, but only one of them will work depending which is declared first.
My question is how can I fix this to be able to run both sensor and sensorChooser, to be able to use voice recognition and gestures.
Thanks for the help, here is the method so far.
private void Window_Loaded(object sender, RoutedEventArgs e) {
if(KinectSensor.KinectSensors.Count > 0)
{
sensor = KinectSensor.KinectSensors[0];
}
this.sensorChooser = new KinectSensorChooser();
this.sensorChooser.KinectChanged += SensorChooserOnKinectChanged;
this.sensorChooserUi.KinectSensorChooser = this.sensorChooser;
initializeSpeech();
sensor.Start();
sensorChooser.Start();
//string[] lines = { "using System;", "namespace First {", "public class Program {", "public static void Main() {", @"Console.WriteLine(""Hello test!""); } } }" };
//System.IO.File.WriteAllLines(@"C:\Users\John\Documents\University\Interface Programming\CW 2\WpfApplication1\test2.txt", lines);
//string code = System.IO.File.ReadAllText(@"C:\Users\John\Documents\University\Interface Programming\CW 2\WpfApplication1\test2.txt");
//runCode(code);
string fileDirectory = System.IO.Directory.GetCurrentDirectory() + @"\User Projects";
DirectoryInfo textFileDirectory = new DirectoryInfo(fileDirectory);
FileInfo[] Files = textFileDirectory.GetFiles("*.txt");
Thickness m = Margin;
m.Left = 0;
foreach (FileInfo file in Files)
{
KinectTileButton btn = new KinectTileButton
{
Label = file.Name,
};
btn.Click += buttonRunCode;
btn.VerticalAlignment = VerticalAlignment.Center;
btn.HorizontalAlignment = HorizontalAlignment.Left;
loadedButtons.Children.Add(btn);
}
}