Exemple #1
0
        void runtime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            bool receivedData = false;

            using (SkeletonFrame SFrame = e.OpenSkeletonFrame())
            {
                if (SFrame == null)
                {
                    return;// The image processing took too long. More than 2 frames behind.
                }
                else
                {
                    skeletons = new Skeleton[SFrame.SkeletonArrayLength];
                    SFrame.CopySkeletonDataTo(skeletons);
                    receivedData = true;
                }
            }

            if (receivedData)
            {
                GuGeZhuiZong.shoubikongzhi();

                Canvas.SetLeft(leftHand, GuGeZhuiZong.leftHand_s.X);
                Canvas.SetTop(leftHand, GuGeZhuiZong.leftHand_s.Y);
                Canvas.SetLeft(rightHand, GuGeZhuiZong.rightHand_s.X);
                Canvas.SetTop(rightHand, GuGeZhuiZong.rightHand_s.Y);
            }
        }
Exemple #2
0
        private void SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            // Speech utterance confidence below which we treat speech as if it hadn't been heard
            const double ConfidenceThreshold = 0.99;

            if (e.Result.Confidence >= ConfidenceThreshold)
            {
                this.textBox1.Text += e.Result.Semantics.Value.ToString() + "\n";
                switch (e.Result.Semantics.Value.ToString())
                {
                case "FORWARD":
                    GuGeZhuiZong.Write("a");
                    break;

                case "BACK":
                    GuGeZhuiZong.Write("b");
                    break;

                case "LEFT":
                    GuGeZhuiZong.Write("2");
                    break;

                case "RIGHT":
                    GuGeZhuiZong.Write("3");
                    break;
                }
            }
        }