Ejemplo n.º 1
0
        /// <summary>
        /// Start color stream at specific resolution
        /// </summary>
        /// <param name="sensor">The reconstruction sensor instance.</param>
        /// <param name="format">The resolution of image in color stream.</param>
        private void StartColorStream(ReconstructionSensor sensor, ColorImageFormat format)
        {
            if (sensor == null)
            {
                return;
            }

            try
            {
                // Enable color stream, register event handler and start
                sensor.ColorFrameReady += this.OnColorFrameReady;
                sensor.StartColorStream(format);
            }
            catch (IOException ex)
            {
                // Device is in use
                this.ShowStatusMessage(ex.Message);

                return;
            }
            catch (InvalidOperationException ex)
            {
                // Device is not valid, not supported or hardware feature unavailable
                this.ShowStatusMessage(ex.Message);

                return;
            }
        }