public MainWindow(string ip, int port, int condition)
        {
            this.ip = ip;
            this.port = port;
            this.condition = condition;
            InitializeComponent();
            completeCheck = new Check.Check();
            ready = true;

            this.Background = new SolidColorBrush(Colors.LightGreen);

            gazeControl = new GazeControl(ip, port);
            kinect = new HCI.GAS.Kinect.KinectAudio("XMLs\\Thoughtfulness_Grammar.xml",ip,port);
            led = new LedsProxy(ip, port);
            led.off("ChestLeds");
            led.on("ChestLedsGreen");

            //TODO: check if auto has been depreciated.
            kinect.auto = false;

            end = false;
            tts = new TextToSpeechProxy(ip, port);
        }
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     end = true;
     if (gazeControl != null)
         gazeControl.end();
     if (kinect != null)
         kinect.EndKinect();
     LedsProxy led = new LedsProxy(ip, port);
     led.off("ChestLeds");
     led.on("ChestLedsRed");
     kinect = null;
 }
 public void task()
 {
     string filename = "Task4--" + DateTime.Now.ToString("MM-dd-hh-mm") + ".txt";
     logfile = new Log(filename, "Task 4 -- Turn Taking");
     logfile.logCondition(condition);
     try
     {
         gazeControl = new GazeControl(ip, port);
         kinect = new HCI.GAS.Kinect.KinectAudio("XMLs\\Turntaking_Grammar.xml", ip, port);
         kinect.auto = false;
     }
     catch (IOException)
     {
         Console.WriteLine("Kinect Not Connected");
     }
     end = false;
     taskThread = new Thread(new ThreadStart(startTask));
     this.Background = new SolidColorBrush(Colors.LightBlue);
     taskThread.Start();
 }