/// <summary>
        /// Sets the current video mode
        /// </summary>
        /// <param name="mode">
        /// Video mode to switch to.
        /// </param>
        protected void SetVideoMode(VideoFrameMode mode)
        {
            // Is this a different mode?
            if (this.Mode == mode)
            {
                return;
            }

            // Stop camera first if running
            bool running = this.IsRunning;

            if (running)
            {
                this.Stop();
            }

            // Check to make sure mode is valid by finding it again
            VideoFrameMode foundMode = VideoFrameMode.Find(mode.Format, mode.Resolution);

            if (foundMode == null)
            {
                throw new Exception("Invalid Video Mode: [" + mode.Format + ", " + mode.Resolution + "]");
            }

            // Save mode
            this.captureMode = mode;

            // All good, switch to new mode
            int result = KinectNative.freenect_set_video_mode(this.parentDevice.devicePointer, foundMode.nativeMode);

            if (result != 0)
            {
                throw new Exception("Mode switch failed. Error Code: " + result);
            }

            // Update image map
            this.UpdateNextFrameImageMap();

            // If we were running before, start up again
            if (running)
            {
                this.Start();
            }
        }