public void ShutdownSensor()
{
forceStop = true;
//Stop the update timer
if (updateTimer != null)
{
updateTimer.Stop();
updateTimer.Elapsed -= updateTime_Elapsed;
updateTimer.Dispose();
updateTimer = null;
}
int count = 0;
int maxCount = 50;
while (count < maxCount) //Wait for the core to stop
{
if (!isRunning)
{
break;
}
Thread.Sleep(10);
}
if (count >= maxCount && isRunning)
{
throw new Exception("Could not stop feedback core!");
}
//TODO: Somehow, the avaliable Kinects datagrid needs to be forced to update here so it knows the server is stopped
}