/// <summary> /// Copies the tests to the test array /// </summary> /// <param name="source"></param> private void CopyArrayToTest(KnownGestures [] source) { _currentSet = new KnownGestures[source.Length]; for (int i = 0; i < source.Length; i++) { _currentSet[i] = source[i]; } }
/// <summary> /// Sets the expected list to the array /// </summary> /// <param name="expected"></param> private void SetExpectedList(KnownGestures[] expected) { _expectedGestures.Items.Clear(); for (int i = 0; i < expected.Length; i++) { _expectedGestures.Items.Add(expected[i].ToString()); } }
/// <summary> /// Runs a test with basic swipes and clockwise /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RunTest1(object sender, RoutedEventArgs e) { ClearDetectedList(); KnownGestures[] testSet1 = new KnownGestures[] { KnownGestures.SwipeDown, KnownGestures.SwipeUp, KnownGestures.SwipeLeft, KnownGestures.SwipeRight, KnownGestures.Clockwise}; CopyArrayToTest(testSet1); SetExpectedList(testSet1); string testFile = System.IO.Path.Combine(Environment.CurrentDirectory, @"data\test1.replay"); Stream testReplayStreeam = File.OpenRead(testFile); _testReplay = new SkeletonReplay(testReplayStreeam); _testReplay.SkeletonFrameReady += replay_SkeletonFrameReady; _currentIndex = 0; _testReplay.Start(); }
/// <summary> /// Runs a test with hands opening and Hands closing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RunTest2(object sender, RoutedEventArgs e) { ClearDetectedList(); KnownGestures[] testSet2 = new KnownGestures[] { KnownGestures.HandsOpened, KnownGestures.HandsClosed}; CopyArrayToTest(testSet2); SetExpectedList(testSet2); string testFile = System.IO.Path.Combine(Environment.CurrentDirectory, @"data\test2.replay"); Stream testReplayStreeam = File.OpenRead(testFile); _testReplay = new SkeletonReplay(testReplayStreeam); _testReplay.SkeletonFrameReady += replay_SkeletonFrameReady; _currentIndex = 0; _testReplay.Start(); }