예제 #1
0
        void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            //Hacemos un switch para ver cual es el estado del dispositivo
            switch (e.Status)
            {
            //En caso de que el status sea Connected quiere decir que hay una conexion correcta entre la PC y el Kinect
            case (KinectStatus.Connected):
                //De la misma forma mandamos llamar al metodo conectaActiva() el cual inicializara el dispositivo Kinect
                conectaActiva();
                break;

            //En caso de que el status sea Disconnected se la variable _sensor se volvera nula e intentaremos buscar otro dispositivo Kinect cuyo estado sea Connected si no se encuentra mandaremos un mensaje indicando que No hay ningun Kinect conectado
            case (KinectStatus.Disconnected):
                if (this.sensor == e.Sensor)
                {
                    this.sensor = null;
                    this.sensor = KinectSensor.KinectSensors.FirstOrDefault(x => x.Status == KinectStatus.Connected);
                    if (this.sensor == null)
                    {
                        Error err = new VME.Error(RecursosLocalizables.StringResources.KinectNoDetect, 3);
                        err.Show();
                    }
                }
                break;
            }
        }
예제 #2
0
        private void microfono_click(object sender, RoutedEventArgs e)
        {
            BitmapImage bi3 = new BitmapImage();

            if (tabControl.SelectedIndex != 0)
            {
                if (desactivarMicrofono == true)
                {
                    bi3.BeginInit();
                    bi3.UriSource = new Uri("Resources/iconoMicrofono.png", UriKind.Relative);
                    bi3.EndInit();
                    imagenMicrofono.Source = bi3;
                    desactivarMicrofono    = false;
                    conectaActiva();
                }
                else
                {
                    bi3.BeginInit();
                    bi3.UriSource = new Uri("Resources/iconoMicrofonoDesactivado.png", UriKind.Relative);
                    bi3.EndInit();
                    imagenMicrofono.Source = bi3;
                    desactivarMicrofono    = true;
                }
            }
            else
            {
                Error err = new VME.Error(RecursosLocalizables.StringResources.IdiomaVoz, 3);
                err.Show();
            }
        }
예제 #3
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         sensor.ElevationAngle = valor;
     }catch (System.InvalidOperationException exc)
     {
         Error err = new VME.Error("Error la kinect no puede ser movida tantas veces simultáneamente, debe esperar a que el movimiento anterior termine.", 0);
         err.Show();
     }
 }
예제 #4
0
        private void kinect_skeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            try
            {
                using (SkeletonFrame frameEsqueleto = e.OpenSkeletonFrame())
                {
                    if (frameEsqueleto != null)
                    {
                        totalSkeleton = new Skeleton[frameEsqueleto.SkeletonArrayLength];
                        frameEsqueleto.CopySkeletonDataTo(totalSkeleton);
                    }
                    if (totalSkeleton == null)
                    {
                        return;
                    }

                    foreach (Skeleton esqueleto in totalSkeleton)
                    {
                        if (esqueleto.TrackingState == SkeletonTrackingState.Tracked)
                        {
                            // Joint handJoint = esqueleto.Joints[JointType.HandRight];
                            // Joint elbowJoint = esqueleto.Joints[JointType.ElbowRight];

                            if (contador == 0 && tabControl.SelectedIndex == 6)
                            {
                                Error err = new VME.Error(RecursosLocalizables.StringResources.cuerpoDetectado, 3);
                                err.Show();
                                contador++;
                            }
                            cuerpoDetectado.IsChecked = true;
                        }
                    }
                }
            }catch (Exception exc)
            {
            }
        }
예제 #5
0
        private void siguienteBienvenida_Click(object sender, RoutedEventArgs e)
        {
            if (tabControl.SelectedIndex == 2)
            {
                Properties.Settings.Default.nombre        = NombreBienvenida.Text;
                Properties.Settings.Default.apellidos     = ApellidosBienvenida.Text;
                Properties.Settings.Default.añoNacimiento = NacimientoBienvenida.Text;
                Properties.Settings.Default.peso          = PesoBienvenida.Text;
            }
            else if (tabControl.SelectedIndex == 3)
            {
                if (escribirCegueraBienvenida.Text == "6" && escribirCeguera2Bienvenida.Text == "42")
                {
                    Properties.Settings.Default.Daltonico = false;
                }
                else
                {
                    Properties.Settings.Default.Daltonico = true;
                }
            }

            else if (tabControl.SelectedIndex == 4)
            {
                if (movilidad2Bienvenida.IsChecked == true)
                {
                    Properties.Settings.Default.tipoMovilidad = 4;
                }
                else if (movilidad3Bienvenida.IsChecked == true)
                {
                    Properties.Settings.Default.tipoMovilidad = 3;
                }
                else if (movilidad4Bienvenida.IsChecked == true)
                {
                    Properties.Settings.Default.tipoMovilidad = 2;
                }
                else if (movilidad5Bienvenida.IsChecked == true)
                {
                    Properties.Settings.Default.tipoMovilidad = 1;
                }
            }
            if ((comboBox.SelectedItem != interfazClaraBienvenida && comboBox.SelectedItem != interfazOscuraBienvenida) && tabControl.SelectedIndex == 1)
            {
                Error err = new VME.Error(RecursosLocalizables.StringResources.faltanParametros, 1);
                err.Show();
            }
            else if (Properties.Settings.Default.tipoMovilidad == 0 && tabControl.SelectedIndex == 4)
            {
                Error err = new VME.Error(RecursosLocalizables.StringResources.faltanParametros, 1);
                err.Show();
            }
            else if (tabControl.SelectedIndex == 6 && cuerpoDetectado.IsChecked == false)
            {
                Error err = new VME.Error(RecursosLocalizables.StringResources.faltanParametros, 1);
                err.Show();
            }
            else if (((Properties.Settings.Default.nombre == "") || (Properties.Settings.Default.apellidos == "") || (Properties.Settings.Default.añoNacimiento == "") || (Properties.Settings.Default.peso == "")) && tabControl.SelectedIndex == 2)
            {
                Error err = new VME.Error(RecursosLocalizables.StringResources.faltanParametros, 1);
                err.Show();
            }
            else if ((escribirCegueraBienvenida.Text == "" || escribirCeguera2Bienvenida.Text == "") && tabControl.SelectedIndex == 3)
            {
                Error err = new VME.Error(RecursosLocalizables.StringResources.faltanParametros, 1);
                err.Show();
            }
            else if (tabControl.SelectedIndex == 0)
            {
                Error err = new VME.Error(RecursosLocalizables.StringResources.faltanParametros, 1);
                err.Show();
            }

            else if (tabControl.SelectedIndex == 7)
            {
                menuPrincipal.desactivarMicrofono = false;
                this.Close();
                Properties.Settings.Default.configuracionInicial = true;
            }
            else
            {
                if (tabControl.SelectedIndex == 5 && KinectSensor.KinectSensors.Count == 0)
                {
                    tabControl.SelectedIndex = tabControl.SelectedIndex + 2;
                }
                else
                {
                    tabControl.SelectedIndex++;
                }
            }
        }