示例#1
0
        public MainWindow()
        {
            InitializeComponent();
            if (KinectSensor.KinectSensors.Count > 0 && KinectSensor.KinectSensors[0].Status == KinectStatus.Connected)
            {
                setupKinect();
                setupVoice();
                checkForCommands();
                setupSFX();
                this.NavigationService.Navigate(new StartScreen());
            }
            else
            {
                KinectStatus status = new KinectStatus();

                if (KinectSensor.KinectSensors.Count == 0)
                {
                    status = KinectStatus.Disconnected;
                }
                else
                {
                    status = KinectSensor.KinectSensors[0].Status;
                }

                this.NavigationService.Navigate(new KinectError(status));
            }
        }
        private void KinectSensorsStatusChanged(object sender, StatusChangedEventArgs e)
        {
            KinectStatus status = e.Status;

            if (Kinect == null)
            {
                UpdateStatus(status);
                if (e.Status == KinectStatus.Connected)
                {
                    Kinect = e.Sensor;
                }
            }
            else
            {
                if (Kinect == e.Sensor)
                {
                    UpdateStatus(status);
                    if (e.Status == KinectStatus.Disconnected ||
                        e.Status == KinectStatus.NotPowered)
                    {
                        Kinect         = null;
                        sensorConflict = false;
                        DiscoverSensor();
                    }
                }
            }
        }
示例#3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            KinectStatus kinectStatus = (KinectStatus)value;

            switch (kinectStatus)
            {
            case KinectStatus.Connected:
                return(new Uri(@".\Images\Good.png", UriKind.Relative));

            case KinectStatus.DeviceNotSupported:
            case KinectStatus.DeviceNotGenuine:
            case KinectStatus.Disconnected:
            case KinectStatus.NotReady:
            case KinectStatus.Error:
            case KinectStatus.Undefined:
            case KinectStatus.NotPowered:
                return(new Uri(@".\Images\Error.png", UriKind.Relative));

            case KinectStatus.Initializing:
                return(new Uri(@".\Images\Busy.gif", UriKind.Relative));

            case KinectStatus.InsufficientBandwidth:
                return(new Uri(@".\Images\Warning.png", UriKind.Relative));

            default:
                throw new NotImplementedException("KinectStatus enum conversion has not been implemented.");
            }
        }
 private void EnsureAudio(KinectSensor sensor, KinectStatus status)
 {
     if ((null != sensor) && (KinectStatus.Connected == status) && sensor.IsRunning)
     {
         this.audioStream = sensor.AudioSource.Start();
     }
 }
示例#5
0
        private void ShowStatus(KinectSensor sensor, KinectStatus status)
        {
            Debug.WriteLine(sensor.DeviceConnectionId + ": " + status);
            switch (status)
            {
            case KinectStatus.Disconnected:
            case KinectStatus.NotPowered:
                if (this.sensors.Contains(sensor))
                {
                    this.sensors.Remove(sensor);
                    this.StopSensor(sensor);
                }

                break;

            default:
                if (!this.sensors.Contains(sensor))
                {
                    this.sensors.Add(sensor);
                    this.StartSensor(sensor);
                }

                break;
            }
        }
示例#6
0
        /// <summary>
        /// This method will use basic logic to try to grab a sensor.
        /// Once a sensor is found, it will start the sensor with the
        /// requested options.
        /// </summary>
        private void DiscoverSensor()
        {
            // Grab any available sensor
            this.Sensor = KinectSensor.KinectSensors.FirstOrDefault();

            if (this.Sensor != null)
            {
                this.LastStatus = this.Sensor.Status;

                // If this sensor is connected, then enable it
                if (this.LastStatus == KinectStatus.Connected)
                {
                    this.Sensor.SkeletonStream.Enable();
                    this.Sensor.ColorStream.Enable(this.colorImageFormat);
                    this.Sensor.DepthStream.Enable(this.depthImageFormat);

                    try
                    {
                        this.Sensor.Start();
                    }
                    catch (IOException)
                    {
                        // sensor is in use by another application
                        // will treat as disconnected for display purposes
                        this.Sensor = null;
                    }
                }
            }
            else
            {
                this.LastStatus = KinectStatus.Disconnected;
            }
        }
示例#7
0
        private static void KinectStatusPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DeviceStatusUserControl deviceStatusUserControl = (DeviceStatusUserControl)d;
            KinectStatus            kinectStatus            = (KinectStatus)e.NewValue;

            deviceStatusUserControl.UpdateKinectStatus(kinectStatus);
        }
示例#8
0
        private void UpdateMessage(KinectStatus status, string message, string moreInfo, Uri moreInfoUri, bool showRetry)
        {
            this.Message     = message;
            this.MoreInfo    = moreInfo;
            this.MoreInfoUri = moreInfoUri;
            this.ShowRetry   = showRetry;

            if ((status == KinectStatus.Connected) && !this.sensorConflict)
            {
                var fadeAnimation = new DoubleAnimation(0, new Duration(TimeSpan.FromMilliseconds(500)));

                fadeAnimation.Completed += (sender, args) =>
                {
                    // If we've reached the end of the animation and achieved total transparency,
                    // the chooser should no longer be clickable - hide it.
                    if (this.Opacity == 0)
                    {
                        this.Visibility = Visibility.Hidden;
                    }
                };

                this.BeginAnimation(UserControl.OpacityProperty, fadeAnimation, HandoffBehavior.SnapshotAndReplace);
            }
            else
            {
                // The chooser is heading towards opaque - as long as it's not completely transparent,
                // it should be Visible and clickable.
                this.Visibility = Visibility.Visible;

                var fadeAnimation = new DoubleAnimation(1.0, new Duration(TimeSpan.FromMilliseconds(500)));
                this.BeginAnimation(UserControl.OpacityProperty, fadeAnimation, HandoffBehavior.SnapshotAndReplace);
            }
        }
示例#9
0
        private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            if (e.Status != KinectStatus.Connected)
            {
                e.Sensor.Stop();
            }

            this.LastStatus = e.Status;
            this.DiscoverSensor();
        }
示例#10
0
 public KKinect()
 {
     Status = KinectStatus.Disconnected;
     Device = KinectSensor.KinectSensors.FirstOrDefault();
     if (Device != null)
     {
         Status = Device.Status;
         KinectSensor.KinectSensors.StatusChanged += new EventHandler <StatusChangedEventArgs>(OnStatusChange);
     }
 }
示例#11
0
        private void ShowStatus(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            sensorStatusChanges.Text += kinectSensor.DeviceConnectionId + " " + kinectStatus + "\n";

            KinectSensorItem sensorItem;

            this.sensorItems.SensorLookup.TryGetValue(kinectSensor, out sensorItem);
            switch (kinectStatus)
            {
            case KinectStatus.Disconnected:
            case KinectStatus.NotPowered:
                if (sensorItem != null)
                {
                    this.sensorItems.Remove(sensorItem);
                    if (sensorItem.Window != null)
                    {
                        sensorItem.Window.Close();
                        sensorItem.Window = null;
                    }
                }

                break;

            default:
                if (sensorItem == null)
                {
                    sensorItem = new KinectSensorItem
                    {
                        Window = null,
                        Sensor = kinectSensor,
                        Status = kinectSensor.Status
                    };
                    this.sensorItems.Add(sensorItem);
                }

                // show a window, if one isn't already shown, unless we are initializing
                if (sensorItem.Window == null && kinectStatus != KinectStatus.Initializing)
                {
                    var kinectWindow = new KinectWindow {
                        Kinect = kinectSensor
                    };
                    kinectWindow.Show();

                    sensorItem.Window = kinectWindow;
                }

                if (sensorItem.Window != null)
                {
                    sensorItem.Window.StatusChanged();
                }

                sensorItem.Status = kinectStatus;
                break;
            }
        }
示例#12
0
        /// <summary>
        /// This wires up the status changed event to monitor for
        /// Kinect state changes.  It automatically stops the sensor
        /// if the device is no longer available.
        /// </summary>
        /// <param name="sender">The sending object.</param>
        /// <param name="e">The event args.</param>
        private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            // If the status is not connected, try to stop it
            if (e.Status != KinectStatus.Connected)
            {
                e.Sensor.Stop();
            }

            LastStatus = e.Status;
            DiscoverSensor();
        }
        private void ShowStatus(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            KinectSensorItem sensorItem;
            this.sensorItems.SensorLookup.TryGetValue(kinectSensor, out sensorItem);

            //kinect is gestopt
            if (KinectStatus.Disconnected == kinectStatus)
            {
                if (sensorItem != null)
                {
                    sensorItem.StreamingStatus = "Stopped";
                    this.sensorItems.Remove(sensorItem);
                    sensorItem.Close();
                }
            }
            else
            {
                //kinect is niew
                if (sensorItem == null)
                {
                    sensorItem = new KinectSensorItem(this, kinectSensor, kinectSensor.DeviceConnectionId, nrOfKinects);
                    sensorItem.Status = kinectStatus;

                    this.sensorItems.Add(sensorItem);
                }
                //kinect heeft een update
                else
                {
                    sensorItem.Status = kinectStatus;
                }
                //eens connected: show window
                if (KinectStatus.Connected == kinectStatus )
                {
                    // show a window by default: off
                    //sensorItem.ShowWindow();
                }
                //indien disconnected: close
                else
                {
                  //  sensorItem.Close();
                }
            }

            this.statusItems.Add(new KinectStatusItem
            {
                Id = (null == kinectSensor) ? null : kinectSensor.DeviceConnectionId,
                Status = kinectStatus,
                DateTime = DateTime.Now,
                Name = (sensorItem != null) ? sensorItem.Name : "Loading...",
                StreamingStatus = (sensorItem != null) ? sensorItem.StreamingStatus : "Not Ready"

            });
        }
        private void ShowStatus(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            this.statusItems.Add(new KinectStatusItem
            {
                Id       = (null == kinectSensor) ? null : kinectSensor.DeviceConnectionId,
                Status   = kinectStatus,
                DateTime = DateTime.Now
            });


            this.sensorItems.SensorLookup.TryGetValue(kinectSensor, out sensorItem);

            if (KinectStatus.Disconnected == kinectStatus)
            {
                if (sensorItem != null)
                {
                    this.sensorItems.Remove(sensorItem);
                    sensorItem.CloseWindow();
                }
            }
            else
            {
                if (sensorItem == null)
                {
                    sensorItem        = new KinectSensorItem(kinectSensor, kinectSensor.DeviceConnectionId, postureIndex);
                    sensorItem.Status = kinectStatus;
                    ///sensorItem.OnChildReturnEvent += new KinectSensorItem.OnChildReturnEvent;

                    this.sensorItems.Add(sensorItem);
                }
                else
                {
                    sensorItem.Status = kinectStatus;
                }

                if (KinectStatus.Connected == kinectStatus)
                {
                    // show a window
                    sensorItem.tempCallBack = WindowClosed1;

                    //sensorItem.OnChildReturnEvent +=new KinectSensorItem.OnChildReturnValueInKinectSensorItem(OnChildReturnEvent);

                    sensorItem.ShowWindow();

                    //sensorItem.callBack
                    //sensorItem.Window.Closed += WindowClosedForKinectCamera;
                }
                else
                {
                    sensorItem.CloseWindow();
                }
            }
        }
示例#15
0
        public KinectError(KinectStatus status)
        {
            InitializeComponent();

            KinectSensor.KinectSensors.StatusChanged += new EventHandler<StatusChangedEventArgs>(KinectSensors_StatusChanged);

            MainWindow.animateFade(imgDimmer, 0, 0.5);

            kinectError = MainWindow.generateError(status);
            MainCanvas.Children.Add(kinectError);
            MainWindow.animateSlide(kinectError);
        }
示例#16
0
        /// <summary>
        /// This method will use basic logic to try to grab a sensor.
        /// Once a sensor is found, it will start the sensor with the
        /// requested options.
        /// </summary>
        private void DiscoverSensor()
        {
            // Grab any available sensor
            this.Sensor = KinectSensor.KinectSensors.FirstOrDefault();

            if (this.Sensor != null)
            {
                this.LastStatus = this.Sensor.Status;

                // If this sensor is connected, then enable it
                if (this.LastStatus == KinectStatus.Connected)
                {
                    try
                    {
                        var parameters = new TransformSmoothParameters
                        {
                            Smoothing          = 0.7f, //0.999f,
                            Correction         = 0.3f, //0.1f,
                            Prediction         = 0.4f, //0.1f,
                            JitterRadius       = 1.0f, //0.05f,
                            MaxDeviationRadius = 0.5f  //0.05f
                        };

                        this.Sensor.SkeletonStream.Enable(parameters);
                        this.Sensor.ColorStream.Enable(this.colorImageFormat);
                        this.Sensor.DepthStream.Enable(this.depthImageFormat);

                        try
                        {
                            this.Sensor.Start();
                        }
                        catch (IOException)
                        {
                            // sensor is in use by another application
                            // will treat as disconnected for display purposes
                            this.Sensor = null;
                        }
                    }
                    catch (InvalidOperationException)
                    {
                        // KinectSensor might enter an invalid state while
                        // enabling/disabling streams or stream features.
                        // E.g.: sensor might be abruptly unplugged.
                        this.Sensor = null;
                    }
                }
            }
            else
            {
                this.LastStatus = KinectStatus.Disconnected;
            }
        }
示例#17
0
        public void OnKinectStatusChanged(KinectStatus status)
        {
            Status = status;
            EventHandler <KinectStatusEventArgs> handler = KinectStatusChanged;

            if (handler != null)
            {
                handler(this, new KinectStatusEventArgs()
                {
                    Status = status
                });
            }
        }
示例#18
0
        private void ShowStatus(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            sensorStatusChanges.Text += kinectSensor.DeviceConnectionId + " " + kinectStatus + "\n";

            KinectSensorItem sensorItem;
            this.sensorItems.SensorLookup.TryGetValue(kinectSensor, out sensorItem);
            switch (kinectStatus)
            {
                case KinectStatus.Disconnected:
                case KinectStatus.NotPowered:
                    if (sensorItem != null)
                    {
                        this.sensorItems.Remove(sensorItem);
                        if (sensorItem.Window != null)
                        {
                            sensorItem.Window.Close();
                            sensorItem.Window = null;
                        }
                    }

                    break;
                default:
                    if (sensorItem == null)
                    {
                        sensorItem = new KinectSensorItem
                        {
                            Window = null,
                            Sensor = kinectSensor,
                            Status = kinectSensor.Status
                        };
                        this.sensorItems.Add(sensorItem);
                    }

                    // show a window, if one isn't already shown, unless we are initializing
                    if (sensorItem.Window == null && kinectStatus != KinectStatus.Initializing)
                    {
                        var kinectWindow = new KinectWindow { Kinect = kinectSensor };
                        kinectWindow.Show();

                        sensorItem.Window = kinectWindow;
                    }

                    if (sensorItem.Window != null)
                    {
                        sensorItem.Window.StatusChanged();
                    }

                    sensorItem.Status = kinectStatus;
                    break;
            }
        }
示例#19
0
 // Zdarzenia
 private void OnStatusChange(object sender, StatusChangedEventArgs e)
 {
     if (Device != null)
     {
         Status = Device.Status;
         if (Status != KinectStatus.Connected)
         {
             StopSensor();
         }
     }
     if (StatusChanged != null)
     {
         StatusChanged(this, EventArgs.Empty);
     }
 }
示例#20
0
        // ReSharper disable once FlagArgument
        private static bool HandleError(KinectStatus status)
        {
            if (status == KinectStatus.Connected)
            {
                return(true);
            }

            MessageBox.Show(
                string.Format("Error: status {0}", status),
                @"Error",
                MessageBoxButtons.OK,
                MessageBoxIcon.Asterisk);

            return(false);
        }
示例#21
0
        public static string GetDeviceStatusDesc(KinectStatus status)
        {
            string s = "";

            switch (status)
            {
            case KinectStatus.Connected:
                s = "Device Connected";
                break;

            case KinectStatus.DeviceNotGenuine:
                s = "Device not genuise";
                break;

            case KinectStatus.DeviceNotSupported:
                s = "Device not supported";
                break;

            case KinectStatus.Disconnected:
                s = "Device disconnected";
                break;

            case KinectStatus.Error:
                s = "Error!";
                break;

            case KinectStatus.Initializing:
                s = "Initializing...";
                break;

            case KinectStatus.InsufficientBandwidth:
                s = "Bandwidth problem!";
                break;

            case KinectStatus.NotPowered:
                s = "Device not powered!";
                break;

            case KinectStatus.NotReady:
                s = "Device not ready!";
                break;

            case KinectStatus.Undefined:
                s = "Unknown error";
                break;
            }
            return(s);
        }
 public void InitValues(frmKinect form, bool isActive, KinectStatus status, string deviceConnId)
 {
     if (isActive)
     {
         this.ksResult             = this.Init();
         form.btnStream.Enabled    = true;
         form.lblStatus.Text       = status.ToString();
         form.lblConnectionID.Text = deviceConnId;
     }
     else
     {
         ksResult.KSensor.Dispose();
         form.btnStream.Enabled    = false;
         form.lblStatus.Text       = status.ToString();
         form.lblConnectionID.Text = deviceConnId;
     }
 }
示例#23
0
        /// <summary>
        /// This method will use basic logic to try to grab a sensor.
        /// Once a sensor is found, it will start the sensor with the
        /// requested options.
        /// </summary>
        public void DiscoverSensor()
        {
            // Grab any available sensor
            this.Sensor = KinectSensor.KinectSensors.FirstOrDefault();

            if (this.Sensor != null)
            {
                this.LastStatus = this.Sensor.Status;

                // If this sensor is connected, then enable it
                if (this.LastStatus == KinectStatus.Connected)
                {
                    try
                    {
                        this.Sensor.SkeletonStream.Enable();
                        this.Sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
                        //						this.Sensor.SkeletonStream.EnableTrackingInNearRange = true;
                        //this.Sensor.ColorStream.Enable( this.colorImageFormat );
                        this.Sensor.DepthStream.Enable(this.depthImageFormat);
                        //this.Sensor.DepthStream.Range = DepthRange.Near;

                        try
                        {
                            this.Sensor.Start();
                        }
                        catch (IOException)
                        {
                            // sensor is in use by another application
                            // will treat as disconnected for display purposes
                            this.Sensor = null;
                        }
                    }
                    catch (InvalidOperationException)
                    {
                        // KinectSensor might enter an invalid state while
                        // enabling/disabling streams or stream features.
                        // E.g.: sensor might be abruptly unplugged.
                        this.Sensor = null;
                    }
                }
            }
            else
            {
                this.LastStatus = KinectStatus.Disconnected;
            }
        }
示例#24
0
        private void ShowStatus(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            this.statusItems.Add(new KinectStatusItem
            {
                Id       = (null == kinectSensor) ? null : kinectSensor.DeviceConnectionId,
                Status   = kinectStatus,
                DateTime = DateTime.Now
            });

            KinectSensorItem sensorItem;

            this.sensorItems.SensorLookup.TryGetValue(kinectSensor, out sensorItem);

            if (KinectStatus.Disconnected == kinectStatus)
            {
                if (sensorItem != null)
                {
                    this.sensorItems.Remove(sensorItem);
                    sensorItem.CloseWindow();
                }
            }
            else
            {
                if (sensorItem == null)
                {
                    sensorItem        = new KinectSensorItem(kinectSensor, kinectSensor.DeviceConnectionId);
                    sensorItem.Status = kinectStatus;

                    this.sensorItems.Add(sensorItem);
                }
                else
                {
                    sensorItem.Status = kinectStatus;
                }

                if (KinectStatus.Connected == kinectStatus)
                {
                    // show a window
                    sensorItem.ShowWindow();
                }
                else
                {
                    sensorItem.CloseWindow();
                }
            }
        }
        private void ShowStatus(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            this.statusItems.Add(new KinectStatusItem 
            { 
                Id = (null == kinectSensor) ? null : kinectSensor.DeviceConnectionId,
                Status = kinectStatus,
                DateTime = DateTime.Now
            });

            KinectSensorItem sensorItem;
            this.sensorItems.SensorLookup.TryGetValue(kinectSensor, out sensorItem);

            if (KinectStatus.Disconnected == kinectStatus)
            {
                if (sensorItem != null)
                {
                    this.sensorItems.Remove(sensorItem);
                    sensorItem.CloseWindow();
                }
            }
            else
            {
                if (sensorItem == null)
                {
                    sensorItem = new KinectSensorItem(kinectSensor, kinectSensor.DeviceConnectionId);
                    sensorItem.Status = kinectStatus;

                    this.sensorItems.Add(sensorItem);
                }
                else
                {
                    sensorItem.Status = kinectStatus;
                }

                if (KinectStatus.Connected == kinectStatus)
                {
                    // show a window
                    sensorItem.ShowWindow();
                }
                else
                {
                    sensorItem.CloseWindow();
                }
            }
        }
示例#26
0
        private void UpdateKinectStatus(KinectStatus kinectStatus)
        {
            switch (kinectStatus)
            {
            case KinectStatus.Connected:
                KinectStatusMessage = _appConflict ? "The Kinect is being used by another application." : "Connected!";
                break;

            case KinectStatus.DeviceNotGenuine:
                KinectStatusMessage = "This Sensor Is Not Genuine!";
                break;

            case KinectStatus.DeviceNotSupported:
                KinectStatusMessage = "Kinect for Xbox Not Supported.";
                break;

            case KinectStatus.Disconnected:
                KinectStatusMessage = "No Kinect Sensor Found!";
                break;

            case KinectStatus.Initializing:
                KinectStatusMessage = "Initializing...";
                break;

            case KinectStatus.NotReady:
            case KinectStatus.Error:
                KinectStatusMessage = "Kinect Found, But An Error Occurred. App conflict?";
                break;

            case KinectStatus.Undefined:
                KinectStatusMessage = "No Kinect Found or An Unknown Error Occurred.";
                break;

            case KinectStatus.InsufficientBandwidth:
                KinectStatusMessage = "Too many USB devices. Please unplug one or more!";
                break;

            case KinectStatus.NotPowered:
                KinectStatusMessage = "Kinect power cord is not connected.";
                break;

            default:
                throw new NotImplementedException("KinectStatus not implemented!");
            }
        }
示例#27
0
        /// <summary>
        /// Sets the status string being transmitted as part of the packet based on the given status
        /// </summary>
        /// <param name="status">The current Kinect status</param>
        public void SetKinectStatus(KinectStatus status)
        {
            switch (status)
            {
            case KinectStatus.Connected:
                m_kinectStatus = m_kinectVersion;
                break;

            case KinectStatus.Disconnected:
            case KinectStatus.Error:
                m_kinectStatus = "No Kinect";
                break;

            case KinectStatus.NotReady:
                m_kinectStatus = "Not Ready";
                break;

            case KinectStatus.NotPowered:
                m_kinectStatus = "No Power";
                break;

            case KinectStatus.InsufficientBandwidth:
                m_kinectStatus = "No USB BW";
                break;

            case KinectStatus.Initializing:
                m_kinectStatus = "Init";
                break;

            case KinectStatus.DeviceNotGenuine:
            case KinectStatus.DeviceNotSupported:
                m_kinectStatus = "Bad Device";
                break;

            /*case MainWindow.ErrorCondition.KinectAppConflict:
             *  m_kinectStatus = "In Use";
             *  break;
             * case MainWindow.ErrorCondition.EngConflict:
             *  m_kinectStatus = "Eng In Use";
             *  break;*/
            default:
                break;
            }
        }
示例#28
0
        /// <summary>
        /// This method will use basic logic to try to grab a sensor.
        /// Once a sensor is found, it will start the sensor with the
        /// requested options.
        /// </summary>
        private void DiscoverSensor()
        {
            // Grab any available sensor
            Sensor = KinectSensor.KinectSensors.FirstOrDefault();

            if (Sensor != null)
            {
                LastStatus = Sensor.Status;

                // If this sensor is connected, then enable it
                if (LastStatus == KinectStatus.Connected)
                {
                    try
                    {
                        Sensor.SkeletonStream.Enable();
                        Sensor.ColorStream.Enable(colorImageFormat);
                        Sensor.DepthStream.Enable(depthImageFormat);

                        try
                        {
                            Sensor.Start();
                        }
                        catch (IOException)
                        {
                            // sensor is in use by another application
                            // will treat as disconnected for display purposes
                            Sensor = null;
                        }
                    }
                    catch (InvalidOperationException)
                    {
                        // KinectSensor might enter an invalid state while
                        // enabling/disabling streams or stream features.
                        // E.g.: sensor might be abruptly unplugged.
                        Sensor = null;
                    }
                }
            }
            else
            {
                LastStatus = KinectStatus.Disconnected;
            }
        }
        public void updateStreamingStats(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            KinectSensorItem sensorItem;
            this.sensorItems.SensorLookup.TryGetValue(kinectSensor, out sensorItem);
            if (null != kinectSensor)
            {
                this.statusItems.Add(new KinectStatusItem
                {
                    Id = (null == kinectSensor) ? null : kinectSensor.DeviceConnectionId,
                    Status = kinectStatus,
                    DateTime = DateTime.Now,
                    Name = (sensorItem != null) ? sensorItem.Name : "Loading...",
                    StreamingStatus = (sensorItem != null) ? sensorItem.StreamingStatus : "Not Ready"

                });
            }

            this.sensorItems.Remove(sensorItem);
            this.sensorItems.Add(sensorItem);
        }
示例#30
0
        /// <summary>
        /// updates the ui with the kinect status; fetches current data from the config
        /// </summary>
        /// <param name="pStatus">specified kinect status</param>
        private void updateKinectStatusDisplay(KinectStatus pStatus)
        {
            this.Dispatcher.Invoke(() =>
            {
                switch (pStatus)
                {
                case KinectStatus.connected:
                    this._StatusBlockKinect.Source   = (ImageSource) new ImageSourceConverter().ConvertFrom(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Resources/cross_256_orange.png"));
                    this._Txtblock_KinectStatus.Text = "not connected";
                    break;

                default:
                    break;
                }
            });
        }
示例#31
0
        /// <summary>
        /// This method will use basic logic to try to grab a sensor.
        /// Once a sensor is found, it will start the sensor with the
        /// requested options.
        /// </summary>
        private void DiscoverSensor()
        {
            // Grab any available sensor
            this.Sensor = KinectSensor.KinectSensors.FirstOrDefault();

            if (this.Sensor != null)
            {
                this.LastStatus = this.Sensor.Status;

                // If this sensor is connected, then enable it
                if (this.LastStatus == KinectStatus.Connected)
                {
                    this.Sensor.SkeletonStream.Enable(new TransformSmoothParameters()
                    {
                        Smoothing          = 0.5f,
                        Correction         = 0.5f,
                        Prediction         = 0.5f,
                        JitterRadius       = 0.05f,
                        MaxDeviationRadius = 0.04f
                    });
                    this.Sensor.ColorStream.Enable(this.colorImageFormat);
                    this.Sensor.DepthStream.Enable(this.depthImageFormat);

                    try
                    {
                        this.Sensor.Start();
                    }
                    catch (IOException)
                    {
                        // sensor is in use by another application
                        // will treat as disconnected for display purposes
                        this.Sensor = null;
                    }
                }
            }
            else
            {
                this.LastStatus = KinectStatus.Disconnected;
            }
        }
示例#32
0
        private void DiscoverSensor()
        {
            this.Sensor = KinectSensor.KinectSensors.FirstOrDefault(); // ustawienienie zmiennej Sensor, przechowujące parametry połączenia z Kinect'em

            if (null != this.Sensor)                                   // warunek zostanie wykonany w przypadku nawiązania połączenia z sensorem Kinect
            {
                this.LastStatus = this.Sensor.Status;                  // ustawienie aktualnego statusu połączenia

                if (this.LastStatus == KinectStatus.Connected)         // sprawdzenie, czy status osiągnął wartość "Connected"
                {
                    try
                    {
                        this.Sensor.SkeletonStream.Enable();                         // włączenie przesyłania danych z sensora dotyczących "NUI Skeleton Tracking"
                        this.Sensor.ColorStream.Enable(this.colorImageFormat);       // włączenie przesyłania danych z sensora od kamery RGB
                        this.Sensor.DepthStream.Enable(this.depthImageFormat);       // włączenie przesyłania danych z sensora od kamery głębokości

                        this.Sensor.SkeletonStream.EnableTrackingInNearRange = true; // zezwolenie na przesyłanie danych dla "NUI Skeleton Tracking" w trybie bliskim (gdy nie wszytskie części składowe osoby śledzonej są widoczne z powodu bliskiej pozycji względem urządzenia)

                        try
                        {
                            this.Sensor.Start(); // uruchom działanie sensora względem danej aplikacji
                        }
                        catch (IOException)
                        {
                            this.Sensor = null; // w przypadku błędu usunąć ustawione wcześniej dane
                        }
                    }
                    catch (InvalidOperationException)
                    {
                        this.Sensor = null; // w przypadku błędu usunąć ustawione wcześniej dane
                    }
                }
            }
            else
            {
                this.LastStatus = KinectStatus.Disconnected; // gdy połączenie nie zostało poprawnie zrealizowane ustaw status na "Disconnected"
            }
        }
示例#33
0
        void WindowOpenAndClose(KinectStatus status, KinectSensor sensor)
        {
            switch (status)
            {
            case KinectStatus.Connected:
                if (!knowtable.ContainsKey(sensor.DeviceConnectionId))
                {
                    ColorWindow cw = new ColorWindow(sensor);
                    knowtable[sensor.DeviceConnectionId] = cw;     //把Connection ID和視窗關聯起來
                    cw.Show();
                }
                break;

            case KinectStatus.Disconnected:
                if (knowtable.ContainsKey(sensor.DeviceConnectionId))
                {
                    ColorWindow w = (ColorWindow)knowtable[sensor.DeviceConnectionId];
                    w.Close();
                    knowtable.Remove(sensor.DeviceConnectionId);     //移除關聯
                }
                break;
            }
        }
示例#34
0
        /// <summary>
        /// Interaktionslogik mit dem Sensor-Status um eine Plug'n'Play Funktionalität zu realisieren
        /// </summary>
        /// <param name="status">Der Sensor-Status</param>
        private void PlugNPlay(KinectStatus status)
        {
            switch (status)
            {
                case KinectStatus.Disconnected:
                    // Sensor war schon mal angeschlossen
                    if (this.sensor != null)
                    {
                        StopKinectRecognizer();
                        this.sensor.Stop();
                    }
                    this.ViewModel.SensorStatus = "Sensor nicht angeschlossen";
                    this.ViewModel.SoundSourceAngle = "0";
                    break;

                case KinectStatus.Connected:
                    if (StartKinectSensor())
                    {
                        StartKinectRecognizer();
                        this.ViewModel.SensorStatus = "Sensor gestartet";
                    }
                    else
                    {
                        this.ViewModel.SensorStatus = "Sensor lässt sich nicht starten";
                        this.ViewModel.SoundSourceAngle = "0";
                    }
                    break;

                case KinectStatus.Initializing:
                    this.ViewModel.SensorStatus = "Sensor initialisieren...";
                    this.ViewModel.SoundSourceAngle = "0";
                    break;

                default:
                    // Sensor zur Sicherheit stopppen
                    StopKinectRecognizer();
                    this.sensor.Stop();
                    this.ViewModel.SensorStatus = "Sensor Fehler: " + SensorStatusGerman(status);
                    this.ViewModel.SoundSourceAngle = "0";
                    break;
            }
        }
示例#35
0
 /// <summary>
 /// Converts a Kinect status into a Kineap status
 /// This gives generic statuses for both devices
 /// </summary>
 /// <param name="status">Kinect status</param>
 /// <returns>Kineap status</returns>
 public KineapStatus GetStatus(KinectStatus status)
 {
     switch (status)
     {
         case KinectStatus.NotPowered:
             return KineapStatus.NOT_CONNECTED;
         case KinectStatus.Disconnected:
             return KineapStatus.NOT_CONNECTED;
         case KinectStatus.Error:
             return KineapStatus.ERROR;
         case KinectStatus.DeviceNotGenuine:
             return KineapStatus.ERROR;
         case KinectStatus.DeviceNotSupported:
             return KineapStatus.ERROR;
         case KinectStatus.InsufficientBandwidth:
             return KineapStatus.ERROR;
         case KinectStatus.Undefined:
             return KineapStatus.ERROR;
         case KinectStatus.NotReady:
             return KineapStatus.PROCESSING;
         case KinectStatus.Initializing:
             return KineapStatus.PROCESSING;
         case KinectStatus.Connected:
             return KineapStatus.CONNECTED;
         default:
             return KineapStatus.NOT_CONNECTED;
     }
 }
示例#36
0
 private void EnsureAudio(KinectSensor sensor, KinectStatus status)
 {
     if ((null != sensor) && (KinectStatus.Connected == status) && sensor.IsRunning)
     {
         this.audioStream = sensor.AudioSource.Start();
     }
 }
 public void StatusChanged(KinectStatus status)
 {
     this.viewModel.KinectSensorManager.KinectSensorStatus = status;
 }
        /// <summary>
        /// This method will use basic logic to try to grab a Sensor.
        /// Once a Sensor is found, it will start the Sensor with the
        /// requested options.
        /// </summary>
        private void DiscoverSensor()
        {
            // Grab any available sensor
            if (KinectSensor.KinectSensors.Count >= 1)
            {
                Sensor = KinectSensor.KinectSensors[0];
            }

            else
            {
                Sensor = null;
            }

            if (Sensor != null)
            {
                lastStatus = Sensor.Status;

                // If this sensor is connected, then enable it
                if (lastStatus == KinectStatus.Connected)
                {
                    Sensor.SkeletonStream.Enable();
                    Sensor.ColorStream.Enable();

                    try
                    {
                        Sensor.Start();
                    }
                    catch (IOException)
                    {
                        // sensor is in use by another application
                        // will treat as disconnected for display purposes
                        Sensor = null;
                    }
                }
            }
            else
            {
                lastStatus = KinectStatus.Disconnected;
            }
        }
示例#39
0
        /// <summary>
        /// Übersetzt die Statusmeldungen des Kinect Sensors
        /// </summary>
        /// <param name="status">Der Sensor-Status</param>
        /// <returns>Status auf deutsch als String</returns>
        private string SensorStatusGerman(KinectStatus status)
        {
            string statusGerman = "";

            switch (status)
            {
                case KinectStatus.Connected:
                    statusGerman = "Angeschlossen";
                    break;
                case KinectStatus.DeviceNotGenuine:
                    statusGerman = "Kein Original Kinect Sensor";
                    break;
                case KinectStatus.DeviceNotSupported:
                    statusGerman = "Gerät wird nicht unterstützt";
                    break;
                case KinectStatus.Disconnected:
                    statusGerman = "Nicht angeschlossen";
                    break;
                case KinectStatus.Error:
                    statusGerman = "Fehler";
                    break;
                case KinectStatus.Initializing:
                    statusGerman = "Initialisieren...";
                    break;
                case KinectStatus.InsufficientBandwidth:
                    statusGerman = "Unzureichend Bandbreite am USB Port";
                    break;
                case KinectStatus.NotPowered:
                    statusGerman = "Keine Stromquelle angeschlossen";
                    break;
                case KinectStatus.NotReady:
                    statusGerman = "Sensor Nicht bereit";
                    break;
                case KinectStatus.Undefined:
                    statusGerman = "Nicht definiert";
                    break;
            }
            return statusGerman;
        }
 public void SetKinectStatus(RosConnectionState newState)
 {
     KinectStatus.SetNewState(newState);
 }
示例#41
0
        private void ShowStatus(KinectSensor sensor, KinectStatus status)
        {
            Debug.WriteLine(sensor.DeviceConnectionId + ": " + status);
            switch (status)
            {
                case KinectStatus.Disconnected:
                case KinectStatus.NotPowered:
                    if (this.sensors.Contains(sensor))
                    {
                        this.sensors.Remove(sensor);
                        this.StopSensor(sensor);
                    }

                    break;
                default:
                    if (!this.sensors.Contains(sensor))
                    {
                        this.sensors.Add(sensor);
                        this.StartSensor(sensor);
                    }

                    break;
            }
        }
        private void ShowStatus(KinectSensor kinectSensor, KinectStatus kinectStatus)
        {
            Console.WriteLine( "Kinect Sensor: " + kinectSensor.DeviceConnectionId + " " + kinectStatus + "\n" );

            if (kinectStatus == KinectStatus.Connected)
            {
                if( !kinectTable.ContainsKey(kinectSensor.DeviceConnectionId) )
                {
                    InitializeKinectServices(kinectSensor);

                    kinectTable.Add(kinectSensor.DeviceConnectionId, kinectSensor);
                    gui.SetKinectEnabled(true);
                    gui.addKinectSensorToList(kinectSensor.DeviceConnectionId);
                    speechSensor = kinectSensor;
                }
            }
            else if (kinectStatus == KinectStatus.Disconnected)
            {
                if (kinectTable.ContainsKey(kinectSensor.DeviceConnectionId))
                {
                    kinectTable.Remove(kinectSensor.DeviceConnectionId);
                    gui.removeKinectSensorToList(kinectSensor.DeviceConnectionId);
                }
                if (kinectTable.Count == 0)
                    gui.SetKinectEnabled(false);
            }
        }
示例#43
0
        private string GetKinectTypeString(KinectStatus status, bool isXBox360Kinect)
        {
            string tempString = "Unknown";

            if (status == KinectStatus.Connected)
            {
                if (isXBox360Kinect)
                {
                    tempString = "Kinect v1 (Xbox)";
                }
                else
                {
                    tempString = "Kinect v1";
                }
            }

            return tempString;
        }
示例#44
0
 public void StatusChanged(KinectStatus status)
 {
     this.viewModel.KinectSensorManager.KinectSensorStatus = status;
 }
示例#45
0
 public void OnKinectStatusChanged(KinectStatus status)
 {
     Status = status;
     EventHandler<KinectStatusEventArgs> handler = KinectStatusChanged;
     if (handler != null) handler(this, new KinectStatusEventArgs() { Status = status});
 }
示例#46
0
        private void UpdateStatus(KinectStatus status)
        {
            string message     = null;
            string moreInfo    = null;
            Uri    moreInfoUri = null;
            bool   showRetry   = false;

            switch (status)
            {
            case KinectStatus.Connected:
                // If there's a sensor conflict, we wish to display all of the normal
                // states and statuses, with the exception of Connected.
                if (this.sensorConflict)
                {
                    message     = "This Kinect is being used by another application.";
                    moreInfo    = "This application needs a Kinect for Windows sensor in order to function. However, another application is using the Kinect Sensor.";
                    moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239812");
                    showRetry   = true;
                }
                else
                {
                    message     = "All set!";
                    moreInfo    = null;
                    moreInfoUri = null;
                }

                break;

            case KinectStatus.DeviceNotGenuine:
                message     = "This sensor is not genuine!";
                moreInfo    = "This application needs a genuine Kinect for Windows sensor in order to function. Please plug one into the PC.";
                moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239813");

                break;

            case KinectStatus.DeviceNotSupported:
                message     = "Kinect for Xbox not supported.";
                moreInfo    = "This application needs a Kinect for Windows sensor in order to function. Please plug one into the PC.";
                moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239814");

                break;

            case KinectStatus.Disconnected:
                if (this.IsRequired)
                {
                    message     = "Required";
                    moreInfo    = "This application needs a Kinect for Windows sensor in order to function. Please plug one into the PC.";
                    moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239815");
                }
                else
                {
                    message     = "Get the full experience by plugging in a Kinect for Windows sensor.";
                    moreInfo    = "This application will use a Kinect for Windows sensor if one is plugged into the PC.";
                    moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239816");
                }

                break;

            case KinectStatus.NotReady:
            case KinectStatus.Error:
                message     = "Oops, there is an error.";
                moreInfo    = "The Kinect Sensor is plugged in, however an error has occured. For steps to resolve, please click the \"Tell me more\" link.";
                moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239817");
                break;

            case KinectStatus.Initializing:
                message     = "Initializing...";
                moreInfo    = null;
                moreInfoUri = null;
                break;

            case KinectStatus.InsufficientBandwidth:
                message     = "Too many USB devices! Please unplug one or more.";
                moreInfo    = "The Kinect Sensor needs the majority of the USB Bandwidth of a USB Controller. If other devices are in contention for that bandwidth, the Kinect Sensor may not be able to function.";
                moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239818");
                break;

            case KinectStatus.NotPowered:
                message     = "Plug my power cord in!";
                moreInfo    = "The Kinect Sensor is plugged into the computer with its USB connection, but the power plug appears to be not powered.";
                moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239819");
                break;
            }

            this.UpdateMessage(status, message, moreInfo, moreInfoUri, showRetry);
        }
        private void UpdateStatus(KinectStatus status)
        {
            string message = null;
            string moreInfo = null;
            Uri moreInfoUri = null;
            bool showRetry = false;

            switch (status)
            {
                case KinectStatus.Connected:
                    // If there's a sensor conflict, we wish to display all of the normal
                    // states and statuses, with the exception of Connected.
                    if (this.sensorConflict)
                    {
                        message = "This Kinect is being used by another application.";
                        moreInfo = "This application needs a Kinect for Windows sensor in order to function. However, another application is using the Kinect Sensor.";
                        moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239812");
                        showRetry = true;
                    }
                    else
                    {
                        message = "All set!";
                        moreInfo = null;
                        moreInfoUri = null;
                    }

                    break;
                case KinectStatus.DeviceNotGenuine:
                    message = "This sensor is not genuine!";
                    moreInfo = "This application needs a genuine Kinect for Windows sensor in order to function. Please plug one into the PC.";
                    moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239813");

                    break;
                case KinectStatus.DeviceNotSupported:
                    message = "Kinect for Xbox not supported.";
                    moreInfo = "This application needs a Kinect for Windows sensor in order to function. Please plug one into the PC.";
                    moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239814");

                    break;
                case KinectStatus.Disconnected:
                    if (this.IsRequired)
                    {
                        message = "Required";
                        moreInfo = "This application needs a Kinect for Windows sensor in order to function. Please plug one into the PC.";
                        moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239815");
                    }
                    else
                    {
                        message = "Get the full experience by plugging in a Kinect for Windows sensor.";
                        moreInfo = "This application will use a Kinect for Windows sensor if one is plugged into the PC.";
                        moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239816");
                    }

                    break;
                case KinectStatus.NotReady:
                case KinectStatus.Error:
                    message = "Oops, there is an error.";
                    moreInfo = "The Kinect Sensor is plugged in, however an error has occured. For steps to resolve, please click the \"Tell me more\" link.";
                    moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239817");
                    break;
                case KinectStatus.Initializing:
                    message = "Initializing...";
                    moreInfo = null;
                    moreInfoUri = null;
                    break;
                case KinectStatus.InsufficientBandwidth:
                    message = "Too many USB devices! Please unplug one or more.";
                    moreInfo = "The Kinect Sensor needs the majority of the USB Bandwidth of a USB Controller. If other devices are in contention for that bandwidth, the Kinect Sensor may not be able to function.";
                    moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239818");
                    break;
                case KinectStatus.NotPowered:
                    message = "Plug my power cord in!";
                    moreInfo = "The Kinect Sensor is plugged into the computer with its USB connection, but the power plug appears to be not powered.";
                    moreInfoUri = new Uri("http://go.microsoft.com/fwlink/?LinkID=239819");
                    break;
            }

            this.UpdateMessage(status, message, moreInfo, moreInfoUri, showRetry);
        }
        private void UpdateMessage(KinectStatus status, string message, string moreInfo, Uri moreInfoUri, bool showRetry)
        {
            this.Message = message;
            this.MoreInfo = moreInfo;
            this.MoreInfoUri = moreInfoUri;
            this.ShowRetry = showRetry;

            if ((status == KinectStatus.Connected) && !this.sensorConflict)
            {
                var fadeAnimation = new DoubleAnimation(0, new Duration(TimeSpan.FromMilliseconds(500)));

                fadeAnimation.Completed += (sender, args) =>
                {
                    // If we've reached the end of the animation and achieved total transparency,
                    // the chooser should no longer be clickable - hide it.
                    if (this.Opacity == 0)
                    {
                        this.Visibility = Visibility.Hidden;
                    }
                };

                this.BeginAnimation(UserControl.OpacityProperty, fadeAnimation, HandoffBehavior.SnapshotAndReplace);
            }
            else
            {
                // The chooser is heading towards opaque - as long as it's not completely transparent,
                // it should be Visible and clickable.
                this.Visibility = Visibility.Visible;

                var fadeAnimation = new DoubleAnimation(1.0, new Duration(TimeSpan.FromMilliseconds(500)));
                this.BeginAnimation(UserControl.OpacityProperty, fadeAnimation, HandoffBehavior.SnapshotAndReplace);
            }
        }
示例#49
0
        /// <summary>
        /// This wires up the status changed event to monitor for 
        /// Kinect state changes.  It automatically stops the sensor
        /// if the device is no longer available.
        /// </summary>
        /// <param name="sender">The sending object.</param>
        /// <param name="e">The event args.</param>
        private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            // If the status is not connected, try to stop it
            if (e.Status != KinectStatus.Connected)
            {
                e.Sensor.Stop();
            }

            this.LastStatus = e.Status;
            this.DiscoverSensor();
        }
示例#50
0
        public static Image generateError(KinectStatus kinectStatus)
        {
            Image kinectError = new Image();
            string errorUri;

            switch (kinectStatus)
            {
                case KinectStatus.DeviceNotGenuine:
                    errorUri = "devicenotgenuine.png";
                    break;
                case KinectStatus.DeviceNotSupported:
                    errorUri = "devicenotsupported.png";
                    break;
                case KinectStatus.Disconnected:
                    errorUri = "disconnected.png";
                    break;
                case KinectStatus.Error:
                    errorUri = "error.png";
                    break;
                case KinectStatus.Initializing:
                    errorUri = "initialising.png";
                    break;
                case KinectStatus.InsufficientBandwidth:
                    errorUri = "insufficientbandwidth.png";
                    break;
                case KinectStatus.NotPowered:
                    errorUri = "notpowered.png";
                    break;
                case KinectStatus.NotReady:
                    errorUri = "notready.png";
                    break;
                case KinectStatus.Undefined:
                default:
                    errorUri = "undefined.png";
                    break;
            }

            kinectError.Source = new BitmapImage(new Uri(
            "/Moto;component/images/kinect-fault/" + errorUri, UriKind.Relative));
            kinectError.Width = 640;
            kinectError.Height = 480;
            return kinectError;
        }
示例#51
0
        /// <summary>
        /// This method will use basic logic to try to grab a sensor.
        /// Once a sensor is found, it will start the sensor with the
        /// requested options.
        /// </summary>
        private void DiscoverSensor()
        {
            // Grab any available sensor
            this.Sensor = KinectSensor.KinectSensors.FirstOrDefault();

            if (this.Sensor != null)
            {
                this.LastStatus = this.Sensor.Status;

                // If this sensor is connected, then enable it
                if (this.LastStatus == KinectStatus.Connected)
                {
                    this.Sensor.SkeletonStream.Enable();
                    this.Sensor.ColorStream.Enable(this.colorImageFormat);
                    this.Sensor.DepthStream.Enable(this.depthImageFormat);

                    try
                    {
                        this.Sensor.Start();
                    }
                    catch (IOException)
                    {                       
                        // sensor is in use by another application
                        // will treat as disconnected for display purposes
                        this.Sensor = null;
                    }
                }
            }
            else
            {
                this.LastStatus = KinectStatus.Disconnected;
            }
        }
        private void UpdateKinectStatus(KinectStatus kinectStatus)
        {
            switch (kinectStatus)
            {
                case KinectStatus.Connected:
                    KinectStatusMessage = _appConflict ? "The Kinect is being used by another application." : "Connected!";
                    break;

                case KinectStatus.DeviceNotGenuine:
                    KinectStatusMessage = "This Sensor Is Not Genuine!";
                    break;

                case KinectStatus.DeviceNotSupported:
                    KinectStatusMessage = "Kinect for Xbox Not Supported.";
                    break;

                case KinectStatus.Disconnected:
                    KinectStatusMessage = "No Kinect Sensor Found!";
                    break;

                case KinectStatus.Initializing:
                    KinectStatusMessage = "Initializing...";
                    break;

                case KinectStatus.NotReady:
                case KinectStatus.Error:
                    KinectStatusMessage = "Kinect Found, But An Error Occurred. App conflict?";
                    break;

                case KinectStatus.Undefined:
                    KinectStatusMessage = "No Kinect Found or An Unknown Error Occurred.";
                    break;

                case KinectStatus.InsufficientBandwidth:
                    KinectStatusMessage = "Too many USB devices. Please unplug one or more!";
                    break;

                case KinectStatus.NotPowered:
                    KinectStatusMessage = "Kinect power cord is not connected.";
                    break;
                default:
                    throw new NotImplementedException("KinectStatus not implemented!");
            }
        }