Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        public VideoAnnotationItem FindAnnotation(TimeSpan time)
        {
            if ((time == null) || (Data == null))
            {
                return(null);
            }

            VideoAnnotationItem sci = FindVideoAnnotationItemTimeSpan(Data.VideoAnnotationItems, time);

            return(sci);
        }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        private void RemoveItem(VideoAnnotationItemCollection scic, string id)
        {
            if ((id == null) || (Data == null))
            {
                return;
            }

            VideoAnnotationItem sci = FindVideoAnnotationItem(scic, id);

            if (sci != null)
            {
                scic.Remove(sci);
            }
        }
Beispiel #5
0
        private void AddItem(VideoAnnotationItemCollection scic, StrokeCollection strokes, string id, string text, TimeSpan time, Point pt)
        {
            VideoAnnotationItem sci = new VideoAnnotationItem();

            sci.ID           = id;
            sci.Title        = id;
            sci.Description  = text;
            sci.Strokes      = strokes;
            sci.InkTimeSpan  = time;
            sci.PositionLeft = pt.X;
            sci.PositionTop  = pt.Y;

            scic.Add(sci);
        }
Beispiel #6
0
        private void PauseShowAnnotation(VideoAnnotationItem sci)
        {
            if (sci == null)
            {
                return;
            }

            Application.Current.Windows[1].Height = _ANNOTATE_HEIGHT;
            ToggleButton1.IsChecked = true;
            ToggleButton1.Content   = "Save";
            myInkCanvas.Strokes     = sci.Strokes.Clone();
            TextBox1.Text           = sci.Description;
            Button1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); // forward click event to pause button
        }
Beispiel #7
0
        private VideoAnnotationItem FindVideoAnnotationItemTimeSpan(VideoAnnotationItemCollection scic, TimeSpan time)
        {
            VideoAnnotationItem sciRet = null;

            foreach (VideoAnnotationItem sci in scic)
            {
                if ((int)sci.InkTimeSpan.TotalSeconds == (int)time.TotalSeconds)
                {
                    sciRet = sci;
                    break;
                }
            }

            return(sciRet);
        }
Beispiel #8
0
        private VideoAnnotationItem FindVideoAnnotationItem(VideoAnnotationItemCollection scic, string id)
        {
            VideoAnnotationItem sciRet = null;

            foreach (VideoAnnotationItem sci in scic)
            {
                if (sci.ID == id)
                {
                    sciRet = sci;
                    break;
                }
            }

            return(sciRet);
        }
Beispiel #9
0
        void OnAnnotationsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((e.AddedItems == null) || (e.AddedItems.Count == 0))
            {
                return;
            }

            VideoAnnotationItem sci = e.AddedItems[0] as VideoAnnotationItem;

            if (sci == null)
            {
                return;
            }

            SeekShowAnnotation(sci);
        }