/* public static PlayerWindow OpenNewPlayerWindow(bool Show = true) { PlayerWindow playerWindow = new PlayerWindow(); PlayerWindows.Add(playerWindow); if (Show) { playerWindow.Show(); } return playerWindow; }*/ public static RecognitionCounter OpenRecognitionCounter() { if (RecognitionCounter == null) { RecognitionCounter = new RecognitionCounter(); RecognitionCounter.Show(); } return RecognitionCounter; }
public void PlayRecording() { if (SKLRecording == null) { return; } if (SKLRecording.Count == 0) { return; } RecognitionCounter recognitionCounter = HendlerHolder.OpenRecognitionCounter(); IsPlaying = true; ChangeContentWhileRecordingOrPlaying(true); Thread ReaderThread = new Thread(PlayerThread); ReaderThread.IsBackground = true; //ReadFile(fileToPlay); //line = 0; ReaderThread.Start(); }
private void PlayerThread() { int line = 0; GDLInterpreter inter = null; RecognitionCounter recognitionCounter = HendlerHolder.OpenRecognitionCounter(); Dispatcher.Invoke( new Action( () => { line = (int)ProgressSlider.Value; if (HendlerHolder.MainWindow.inter != null) { inter = new GDLInterpreter(HendlerHolder.MainWindow.inter.FeatureTable, HendlerHolder.MainWindow.inter.RuleTable); } })); TSkeleton[] TSkeletons = null; while (line < SKLRecording.Count && IsPlaying) { TSkeletons = (TSkeleton[])SKLRecording[line]; if (inter != null) { double seconds = (double)TSkeletons[0].TimePeriod / 1000.0; Point3D[] bodyParts = HendlerHolder.GenerateBodyPartArray(TSkeletons[0], 0); //String[] con = inter.ReturnConclusions(fT, 0, seconds); //String[] con = inter.ReturnConclusions(bodyParts, 0, seconds); String[] con = inter.ReturnConclusions(bodyParts, seconds); String allConclusions = ""; String conclusionsWithExclamation = ""; for (int a = 0; a < con.Length; a++) { allConclusions += con[a] + "\r\n"; if (con[a].Contains("!")) { conclusionsWithExclamation += con[a] + "\r\n"; } Dispatcher.Invoke( new Action( () => { recognitionCounter.AddToDictionary(con[a]); })); } UpdateGDLOutput(allConclusions, conclusionsWithExclamation); } Dispatcher.Invoke(new Action( () => { ProgressSlider.Value += 1; DrawImage(TSkeletons); })); Thread.Sleep((int)TSkeletons[0].TimePeriod); line++; } Dispatcher.Invoke(new Action( () => { StopPlaying(); })); }