Ejemplo n.º 1
0
        public bool ChangeGesture()
        {
            if (gestureTypeList.Count == 0 && firstDirectionRun)
            {
                GestureDirection direction = GestureParser.GetDirectionContext() == GestureDirection.Pull ? GestureDirection.Push : GestureDirection.Pull;
                StartTest(direction);
                done = true;
                return(true);
            }
            practiceDone     = false;
            targetSequence   = Target.GetNextSequence();
            practiceSequence = Target.GetPracticeTargets();

            practiceSequence.Enqueue(targetSequence.Dequeue());

            board.Clear();
            board.StartNewGesture();
            board.CreateTarget(practiceSequence.Dequeue());
            GestureParser.SetTypeContext(gestureTypeList.Dequeue());

            Logger.CurrentLogger.StartPracticeTime(GestureParser.GetTypeContext(), GestureParser.GetDirectionContext());
            VideoWindow.PlayVideo(GestureParser.GetDirectionContext(), GestureParser.GetTypeContext());
            Console.WriteLine($"Changed to gesture: {GestureParser.GetTypeContext()} {GestureParser.GetDirectionContext()}");
            return(true);
        }
Ejemplo n.º 2
0
        public CanvasWindow(bool accuracyTest = true)
        {
            this.accuracyTest = accuracyTest;

            targetColor = accuracyTest ? Brushes.White : Brushes.DarkGray;

            source = accuracyTest? DataSource.Accuracy : DataSource.Target;

            sounds.Add("hit", new SoundPlayer("resources/hit.wav"));
            sounds.Add("miss", new SoundPlayer("resources/miss.wav"));

            shapes = new List <String>();
            shapes.Add("circle");
            shapes.Add("square");
            GestureParser.Initialize(this);
            currentSize = GridSize.Small;
            window      = this;
            InitializeComponent();
            kinectManager = new KinectManager(this);
            VideoWindow.SetCanvasWindow(this);
        }
Ejemplo n.º 3
0
 public static void PlayVideo(GestureDirection direction, GestureType type)
 {
     videoWindow?.Close();
     videoWindow = new VideoWindow(direction, type);
 }
Ejemplo n.º 4
0
        private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Space)
            {
                Background = Brushes.Black;/*
                                            * if (connection == null || !connection.Connected) {
                                            * connectedLabel.BeginAnimation(Canvas.OpacityProperty, CreateAnimation(5, 1, 0));
                                            * return;
                                            * }*/
                if (currentTest == null)
                {
                    currentTest = new TestSuite(this, source);
                    kinectManager.Recalibrate();
                    testIDLabel.Content = "User ID: " + currentTest.UserID;
                    testIDLabel.BeginAnimation(Canvas.OpacityProperty, CreateAnimation(10, 1, 0));
                }
                else if (runningTest && !runningGesture)
                {
                    currentTest.ChangeGesture();
                }
            }
            else if (e.Key == System.Windows.Input.Key.Up)
            {
                if (currentTest != null)
                {
                    currentTest.StartTest(GestureDirection.Push);
                }
            }
            else if (e.Key == System.Windows.Input.Key.Down)
            {
                if (currentTest != null)
                {
                    currentTest.StartTest(GestureDirection.Pull);
                }
            }

            else if (e.Key == System.Windows.Input.Key.I)
            {
                PointAt(0, 0);
            }

            else if (e.Key == System.Windows.Input.Key.Q)
            {
                StartDebugTest(GestureType.Swipe);
            }
            else if (e.Key == System.Windows.Input.Key.W)
            {
                StartDebugTest(GestureType.Throw);
            }
            else if (e.Key == System.Windows.Input.Key.E)
            {
                StartDebugTest(GestureType.Pinch);
            }
            else if (e.Key == System.Windows.Input.Key.R)
            {
                StartDebugTest(GestureType.Tilt);
            }

            else if (e.Key == System.Windows.Input.Key.Enter)
            {
                kinectManager.Recalibrate();
                ShowStatusMessage("Recalibrating...");
            }

            else if (e.Key == System.Windows.Input.Key.U)
            {
                VideoWindow.PlayVideo(GestureDirection.Pull, types.Dequeue());
            }

            else if (e.Key == System.Windows.Input.Key.A)
            {
                ShowStatusMessage("Push");
                GestureParser.SetDirectionContext(GestureDirection.Push);
            }
            else if (e.Key == System.Windows.Input.Key.S)
            {
                ShowStatusMessage("Pull");
                GestureParser.SetDirectionContext(GestureDirection.Pull);
            }
        }
Ejemplo n.º 5
0
 public static void PlayVideo(GestureDirection direction, GestureType type)
 {
     videoWindow?.Close();
     videoWindow = new VideoWindow(direction, type);
 }