public void init(ref KinectSensor sensor, ref MainWindow _main)
        {
            _sensor = sensor;
            _mainWin = _main;

            setupKinectOrNoK();
            // Ensure we only have ONE photo submitter
            _photoSubmitter = new ThreadedPhotoSubmission();
            _photoSubmitter.ImageSubmissionComplete += handlePhotoSubmittedToCMS;
        }
        public void init(ref KinectSensor sensor, double _width, double _height, string _initialBG, string _initialFG)
        {
            _sensor = sensor;
            _thisWidth = _width;
            _thisHeight = _height;

            setupKinectOrNoK(_initialBG, _initialFG);
            // Ensure we only have ONE photo submitter
            _photoSubmitter = new ThreadedPhotoSubmission();
            _photoSubmitter.ImageSubmissionComplete += handlePhotoSubmittedToCMS;

        }
        public void destroyInternals()
        {
            if (_sensor != null)
            {
                _sensor.ColorFrameReady -= kinectColorFrameReady;
            }

            if (_kColorImage != null)
            {
                if (kiddieHolder.Children.Contains(_kColorImage))
                {
                    kiddieHolder.Children.Remove(_kColorImage);
                }

                _kColorImage.Source = null;
                _kColorImage = null;
                this.colorPixels = null;
                this.colorBitmap = null;
            }
            if (_noKinect != null)
            {
                if (kiddieHolder.Children.Contains(_noKinect))
                {
                    kiddieHolder.Children.Remove(_noKinect);
                }
                _noKinect = null;
            }
            if (_photoSubmitter != null)
            {
                _photoSubmitter.ImageSubmissionComplete -= handlePhotoSubmittedToCMS;
                _photoSubmitter.destroyInternals();
                _photoSubmitter = null;
            }

            destroySFXPlayer();

            // Re-enable the cursors just in case
            if (_mainWin != null)
            {
                _mainWin.enableDisableAllCursors(true);
            }

            destroyed = true;
        }
        public void destroyInternals()
        {
            if (_sensor != null)
            {
                _sensor.AllFramesReady -= kinectAllFramesReady;
            }
            if (_greenScreenProcessor != null)
            {
                _greenScreenProcessor.frameReadyForDisplay -= greenScreenFrameReady;
                _greenScreenProcessor.destroyInternals();
                _greenScreenProcessor = null;
            }

            if (_bgImage != null)
            {
                if (kiddieHolder.Children.Contains(_bgImage))
                {
                    kiddieHolder.Children.Remove(_bgImage);
                }

                _bgImage.Source = null;
            }

            if (_fgImage != null)
            {
                if (kiddieHolder.Children.Contains(_fgImage))
                {
                    kiddieHolder.Children.Remove(_fgImage);
                }

                _fgImage.Source = null;
            }

            if (_kColorImage != null)
            {

                if (kiddieHolder.Children.Contains(_kColorImage))
                {
                    kiddieHolder.Children.Remove(_kColorImage);
                }

                _kColorImage.Effect = null;
                _kColorImage.Source = null;
                _kColorImage = null;
                this.colorBitmap = null;

                _monoFX = null;
            }
            if (_noKinect != null)
            {
                if (kiddieHolder.Children.Contains(_noKinect))
                {
                    kiddieHolder.Children.Remove(_noKinect);
                }
                _noKinect = null;
            }
            if (_photoSubmitter != null)
            {
                _photoSubmitter.ImageSubmissionComplete -= handlePhotoSubmittedToCMS;
                _photoSubmitter.destroyInternals();
                _photoSubmitter = null;
            }
           
        }