private void VerifyInit()
        {
            if (context != null)
            {
                return;
            }
            string initFile = @"data/openni.xml";

            bool isInit = false;
            while (!isInit)
            {
                try
                {
                    context = new Context(initFile);
                    isInit = true;
                }
                catch (StatusException ex)
                {
                    Trace.WriteLine("OpenNI StatusException: " + ex.ToString());
                    isInit = false;
                    Thread.Sleep(1000);
                }
                catch (GeneralException ex)
                {
                    Trace.WriteLine("GeneralException: " + ex.ToString());
                    isInit = false;
                    IsGeneratorThreadRunning = false;
                    return;
                }
            }

            this.joints = new Dictionary<int, Dictionary<SkeletonJoint, SkeletonJointPosition>>();

            this.userGenerator = new UserGenerator(this.context);
            this.skeletonCapability = userGenerator.SkeletonCapability;
            this.poseDetectionCapability = userGenerator.PoseDetectionCapability;
            this.calibPose = this.skeletonCapability.CalibrationPose;

            this.userGenerator.NewUser += new EventHandler<NewUserEventArgs>(userGenerator_NewUser);
            this.userGenerator.LostUser += new EventHandler<UserLostEventArgs>(userGenerator_LostUser);
            this.poseDetectionCapability.PoseDetected += new EventHandler<PoseDetectedEventArgs>(poseDetectionCapability_PoseDetected);
            this.skeletonCapability.CalibrationEnd += new EventHandler<CalibrationEndEventArgs>(skeletonCapability_CalibrationEnd);

            this.skeletonCapability.SetSkeletonProfile(SkeletonProfile.Upper);
            this.userGenerator.StartGenerating();

            depthGenerator = context.FindExistingNode(NodeType.Depth) as DepthGenerator;

            depthGenerator.NewDataAvailable += new EventHandler(depthGenerator_NewDataAvailable);

            this.histogram = new int[depthGenerator.DeviceMaxDepth];

            depthGenerator.StartGenerating();
        }