Beispiel #1
0
        private void SyncVideoCursor()
        {
            var projectData     = this.ServiceProvider.GetRequiredService <IVideoPlayerProjectData>();
            var projectSettings = this.ServiceProvider.GetRequiredService <IProjectSettings>();
            var currentTCStr    = "UNKNOWN";
            var currentSubStr   = string.Empty;
            ITimeCodeDocumentItem <string> currentSub = null;

            if (projectData.CursorMs.HasValue)
            {
                var fr       = projectSettings.FrameRate;
                var offsetTC = TimeCode.FromFrames(projectSettings.OffsetFrames, fr);
                var cursorTC = offsetTC.Add(TimeCode.FromSeconds(projectData.CursorMs.Value / 1000.0, fr));
                currentTCStr = cursorTC.ToString();

                //TODO Get current subtitle
                //if (this.SubtitleItems != null && this.SubtitleItems.Any())
                //{
                //    currentSub = this.SubtitleItems.FirstOrDefault(p => cursorTC.TotalFrames >= p.RecordIn.TotalFrames && cursorTC.TotalFrames <= p.RecordOut.TotalFrames);
                //}
            }

            //if (currentSub != null)
            //{
            //    currentSubStr = currentSub.Content;
            //    this.x_TextBox.StartHighlight(currentSub.TextSpan, WrappedTextBox.HighlightKind.VideoCursor, true);
            //}
            //else
            //{
            //    this.x_TextBox.ClearHighlights(p => p.Kind == WrappedTextBox.HighlightKind.VideoCursor);
            //}

            //this.x_TextBlock_TimeCode.Text = currentTCStr;
            //this.x_TextBlock_CurrentSubtitle.Text = currentSubStr;
        }
 protected virtual SubtitleControl CreateUIElement(ITimeCodeDocumentItem <string> subtitle)
 {
     return(new SubtitleControl
     {
         Item = subtitle
     });
 }
 private void OnHoverStart(ITimeCodeDocumentItem <string> item)
 {
     var hov = this.HoverStart; if (hov != null)
     {
         hov(this, new SubtitleHoverEventArgs {
             Item = item
         });
     }
 }
 private void OnItemChanged(ITimeCodeDocumentItem <string> newValue, ITimeCodeDocumentItem <string> oldValue)
 {
     this.InvalidateText();
 }