private void OnCurrentTimeInvalidated(object sender, EventArgs e) { Clock clock = (Clock)sender; if (clock == null) { return; } _CurrentMediaTimeSpan = new TimeSpan(clock.CurrentTime.Value.Ticks); TimerText.Text = _CurrentMediaTimeSpan.ToString(); Slider1.Value = _CurrentMediaTimeSpan.Seconds; //DebugHelp3D.Trace.Message(_CurrentMediaTimeSpan.TotalSeconds.ToString()); // determine if we need to pause and show an annotation if (((int)_CurrentMediaTimeSpan.TotalSeconds) == 0) { _CurrentSecond = 0; } if (_CurrentSecond <= (int)_CurrentMediaTimeSpan.TotalSeconds) { //DebugHelp3D.Trace.Message(_CurrentSecond.ToString()); VideoAnnotationItem sci = _VideoAnnotation.FindAnnotation(_CurrentMediaTimeSpan); if (sci != null) { Storyboard s = (Storyboard)DocumentRoot.FindResource("OnLoaded"); s.Seek(DocumentRoot, TimeSpan.FromSeconds(sci.InkTimeSpan.TotalSeconds), TimeSeekOrigin.BeginTime); PauseShowAnnotation(sci); } _CurrentSecond = (int)_CurrentMediaTimeSpan.TotalSeconds + 1; } }
private void SeekShowAnnotation(VideoAnnotationItem sci) { if (sci == null) { return; } PauseShowAnnotation(sci); Storyboard s = (Storyboard)DocumentRoot.FindResource("OnLoaded"); s.Seek(DocumentRoot, TimeSpan.FromSeconds(sci.InkTimeSpan.TotalSeconds), TimeSeekOrigin.BeginTime); _CurrentSecond = (int)sci.InkTimeSpan.TotalSeconds; }