public DataProducerPage()
        {
            InitializeComponent();

            this.Loaded += (s, e) => {
                messageQueue = CommonDataMessageQueue.getInstance(GlobalVariable.messageQueueInterval);

                DiscoverKinectSensor();
                this.drawingGroup           = new DrawingGroup();
                this.imageSource            = new DrawingImage(this.drawingGroup);
                skeletonImageElement.Source = this.imageSource;
            };

            this.Unloaded += (s, e) =>
            {
                UninitializeKinectSensor(this.kinectSensor);
                this.kinectSensor = null;

                if (messageQueue != null)
                {
                    messageQueue.release();
                    messageQueue = null;
                }

                if (vectorSender != null)
                {
                    vectorSender.stop();
                    vectorSender = null;
                }
            };
        }
 public void stop()
 {
     try
     {
         state = false;
     } catch (Exception e)
     {
         LogUtil.log(e.Message);
     }
     messageQueue.release();
     consumeThread = null;
 }