Пример #1
0
        public GestureStatus GetStatus()
        {
            GestureStatus result = new GestureStatus();

            result.GestureName = this.Gesture.Name;

            string stepName = "";

            if (this.GetCurrentStep().MotionRestriction != MotionRestriction.None)
            {
                stepName += this.GetCurrentStep().MotionRestriction + " ";
            }

            stepName += this.GetCurrentStep().Pose.Name + " ";

            if (this.GetCurrentStep().HoldRestriction > 0)
            {
                stepName += "by " + this.GetCurrentStep().HoldRestriction + " seconds";
            }

            foreach (var step in this.Gesture.Steps)
            {
                result.StepNames.Add(step.ToString());
            }

            result.Distance        = this.LastDistance;
            result.DistanceVectors = this.LastDistanceVectors;
            result.CompletedCount  = this.CompletedCount;
            result.CurrentStep     = this.CurrentStep;
            result.NumSteps        = this.Gesture.Steps.Count;

            return(result);
        }
Пример #2
0
        public GestureStatus GetStatus()
        {
            GestureStatus result = new GestureStatus();

            result.Name            = this.Gesture.Name;
            result.MainInstruction = this.MainRestriction;

            //result.StepNamesAndDescriptions = new List<Tuple<string, string>>(this.Gesture.Steps.Capacity);

            //foreach (var step in this.Gesture.Steps)
            //    result.StepNamesAndDescriptions.Add(new Tuple<string, string>(
            //        this.GetCurrentStep().Pose.Name,
            //        this.GetCurrentStep().Pose.ToString()));

            result.StepPercentage   = this.StepLastPercentage;
            result.DistanceVectors  = this.LastDistanceVectors;
            result.CompletedCount   = this.CompletedCount;
            result.CurrentStep      = this.CurrentStep;
            result.NumSteps         = this.Gesture.Steps.Count;
            result.AccumulatedError = this.AccumulatedError;

            return(result);
        }
Пример #3
0
        public GestureStatus GetStatus()
        {
            GestureStatus result = new GestureStatus();

            result.GestureName = this.Gesture.Name;

            string stepName = "";

            if (this.GetCurrentStep().MotionRestriction != MotionRestriction.None)
                stepName += this.GetCurrentStep().MotionRestriction + " ";

            stepName += this.GetCurrentStep().Pose.Name + " ";

            if (this.GetCurrentStep().HoldRestriction > 0)
                stepName += "by " + this.GetCurrentStep().HoldRestriction + " seconds";

            foreach (var step in this.Gesture.Steps)
                result.StepNames.Add(step.ToString());

            result.Distance = this.LastDistance;
            result.DistanceVectors = this.LastDistanceVectors;
            result.CompletedCount = this.CompletedCount;
            result.CurrentStep = this.CurrentStep;
            result.NumSteps = this.Gesture.Steps.Count;

            return result;
        }
Пример #4
0
        public void RenderFeedback(GestureStatus status)
        {
            // set ProgressBar.Value
            var GesturePercentage = status.GetGesturePercentage();
            if(status.Succeeded)
            {
                this.ProgressBar.Value = 1.0; // set to 100% directly
                this.Stopwatch.Restart(); // restart MainInstruction cooldown because gesture was completed
            }
            else
            {
                if (this.ProgressBar.Value == 1) // it means the gesture was completed on the last frame
                {
                    this.ProgressBar.Value = 0.0;
                }
                else if (status.AccumulatedError >= 1.0) // it means gesture was broken
                {
                    this.ProgressBar.Value = 0.0;
                }
                else
                {
                    this.ProgressBar.Value = this.ProgressBar.Value * 0.5 + GesturePercentage * 0.5;
                }
            }

            // set FailureBar.Value
            if (status.Broke)
            {
                this.FailureBar.Value = 1.0;
                this.FailureBar.Foreground = Brushes.Red;
                this.Stopwatch.Restart(); // restart MainInstruction cooldown because gesture was broke
            }
            else if(GesturePercentage >= 1)
            {
                this.FailureBar.Value = 0.0;
            }
            else
            {
                this.FailureBar.Value = this.FailureBar.Value * 0.5 + status.AccumulatedError * 0.5;
                this.FailureBar.Foreground = Brushes.Orange;
            }

            // set MainInstruction
            // MainInstruction is updated only after a cooldown
            // this makes it easier for the user to read the instruction
            var cooldown = 0;
            var elapsed = this.Stopwatch.ElapsedMilliseconds;
            if(elapsed > cooldown)
            {
                this.CurrentStepTextBlock.Text = status.MainInstruction; //Name;
                elapsed = 0;
                this.Stopwatch.Restart();
            }

            // set CompletedCount
            this.CompletedTimesTextBlock.Text = status.CompletedCount.ToString();
            this.Height =
                this.MainGestureAndPoseNameTextBlock.ActualHeight +
                this.ProgressBar.ActualHeight +
                this.CurrentStepTextBlock.ActualHeight +
                10;
        }
Пример #5
0
        public GestureStatus GetStatus()
        {
            GestureStatus result = new GestureStatus();

            result.Name = this.Gesture.Name;
            result.MainInstruction = this.MainRestriction;

            //result.StepNamesAndDescriptions = new List<Tuple<string, string>>(this.Gesture.Steps.Capacity);

            //foreach (var step in this.Gesture.Steps)
            //    result.StepNamesAndDescriptions.Add(new Tuple<string, string>(
            //        this.GetCurrentStep().Pose.Name,
            //        this.GetCurrentStep().Pose.ToString()));

            result.StepPercentage = this.StepLastPercentage;
            result.DistanceVectors = this.LastDistanceVectors;
            result.CompletedCount = this.CompletedCount;
            result.CurrentStep = this.CurrentStep;
            result.NumSteps = this.Gesture.Steps.Count;
            result.AccumulatedError = this.AccumulatedError;

            return result;
        }