private void setupKinectOrNoK()
        {
            if (_sensor != null)
            {
                // Create the image
                _kColorImage = new Image();
                _kColorImage.Name = "UserPhoto";
                _kColorImage.Width = contentBorder.Width;
                _kColorImage.Height = contentBorder.Height;
                kiddieHolder.Children.Add(_kColorImage);

                this.colorPixels = new byte[this._sensor.ColorStream.FramePixelDataLength];
                this.colorBitmap = new WriteableBitmap(this._sensor.ColorStream.FrameWidth, this._sensor.ColorStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null);
                this._kColorImage.Source = this.colorBitmap;

                _sensor.ColorFrameReady += kinectColorFrameReady;
            }
            else
            {
                // Create the kinect needed
                _noKinect = new KFWIcon();
                _noKinect.Name = "kwfLogo";
                _noKinect.Width = 328;
                _noKinect.Height = 180;
                _noKinect.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                _noKinect.VerticalAlignment = System.Windows.VerticalAlignment.Center;
                kiddieHolder.Children.Add(_noKinect);
            }
        }
        private void setupKinectOrNoK(chromaKeyImageData _initalData)
        {
            // Create the background image reguardless
            _bgImage = new Image();
            _bgImage.Name = "backgroundImage";
            _bgImage.Width = _thisWidth;
            _bgImage.Height = _thisHeight;
            _bgImage.Stretch = Stretch.Fill;
            kiddieHolder.Children.Add(_bgImage);

            _bgImage.Source = _initalData.BackgroundImageBM;

            if (_sensor != null)
            {
                // Create the image
                _kColorImage = new Image();
                _kColorImage.Name = "UserPhoto";
                _kColorImage.Width = 640 * Properties.Settings.Default.kinectDepthImageScale;
                _kColorImage.Height = 480 * Properties.Settings.Default.kinectDepthImageScale;
                kiddieHolder.Children.Add(_kColorImage);
                // This does fill or exceede the visual area but the kinects depth stream is not as large as the color stream..so we need to offset the left and
                // top by a uniform ammount as we scale too.
                Canvas.SetTop(_kColorImage, _depthTopOffset);
                Canvas.SetLeft(_kColorImage, _depthLeftOffset);

                this.colorBitmap = new WriteableBitmap(this._sensor.ColorStream.FrameWidth, this._sensor.ColorStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null);
                this.maskBitmap = new WriteableBitmap(_sensor.DepthStream.FrameWidth, _sensor.DepthStream.FrameHeight, 96, 96, PixelFormats.Bgra32, null);
                this._kColorImage.Source = this.colorBitmap;

                // colorBitmap serves as our main source for the player image - BUT we have an opacity mask on that guy too which is generated
                // from an image brush made by our "green screen" data. By having that secondary image we can use fast WPF blurs on it and do other
                // manipulations
                _blurMaskSource = new Image();
                blurMaskEffect = new BlurEffect();
                blurMaskEffect.Radius = _postblurAmmount;

                blurMaskVisualBrush = new VisualBrush();
                blurMaskVisualBrush.Visual = _blurMaskSource;
                //_blurMaskSource.Source = maskBitmap;
                _blurMaskSource.Effect = blurMaskEffect;

                this._kColorImage.OpacityMask = this.blurMaskVisualBrush;

                // Init the green screen work horse
                _greenScreenProcessor = new GreenScreenImplementation(this._sensor);
                _blurMaskSource.Source = _greenScreenProcessor.greenScreenMask;
                _greenScreenProcessor.frameReadyForDisplay += greenScreenFrameReady;

                _sensor.AllFramesReady += kinectAllFramesReady;
            }
            else
            {
                // Create the kinect needed
                _noKinect = new KFWIcon();
                _noKinect.Name = "kwfLogo";
                _noKinect.Width = 328;
                _noKinect.Height = 180;
                _noKinect.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                _noKinect.VerticalAlignment = System.Windows.VerticalAlignment.Center;
                kiddieHolder.Children.Add(_noKinect);
            }

            // Foreground too, but it may not have anything
            _fgImage = new Image();
            _fgImage.Name = "foregroundImage";
            _fgImage.Width = _thisWidth;
            _fgImage.Height = _thisHeight;
            _fgImage.Stretch = Stretch.Fill;
            kiddieHolder.Children.Add(_fgImage);

            if (_initalData.ForegroundImageBM != null)
            {
                _fgImage.Source = _initalData.ForegroundImageBM;
            }
        }
        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;
            }
           
        }