private void GetTextRecursive(CaptionElement captionElement, ref string text)
 {
     if (captionElement.IsActiveAtPosition(this._mediaPosition) && (captionElement.CurrentStyle.Display == Visibility.Visible))
     {
         if (captionElement.CaptionElementType == TimedTextElementType.Container)
         {
             foreach (CaptionElement element in captionElement.Children.Cast<CaptionElement>())
             {
                 this.GetTextRecursive(element, ref text);
             }
         }
         else if (captionElement.CaptionElementType == TimedTextElementType.Text)
         {
             text = text + captionElement.Content + Environment.NewLine;
         }
     }
 }
 private void RenderElementRecurse(StackPanel parent, ref StackPanel p, CaptionElement element, ref double offset, TextAlignment align)
 {
     if (element.IsActiveAtPosition(this._mediaPosition) && (element.CurrentStyle.Display == Visibility.Visible))
     {
         if (element.CaptionElementType == TimedTextElementType.Text)
         {
             string text = (element.Content != null) ? element.Content.ToString() : string.Empty;
             offset = this.WrapElement(parent, ref p, offset, text, element, align, false);
         }
         else if (element.CaptionElementType == TimedTextElementType.Container)
         {
             foreach (CaptionElement element2 in element.Children)
             {
                 this.RenderElementRecurse(parent, ref p, element2, ref offset, align);
             }
         }
         else if (element.CaptionElementType == TimedTextElementType.LineBreak)
         {
             p = this.NewPanel(parent, ref offset, element, align);
         }
     }
 }
 private void RenderElementRecurse(StackPanel parent, ref StackPanel p, CaptionElement element, ref double offset, TextAlignment align)
 {
     if (element.IsActiveAtPosition(_mediaPosition) && element.CurrentStyle.Display == System.Windows.Visibility.Visible)
     {
         if (element.CaptionElementType == TimedTextElementType.Text)
         {
             var text = element.Content != null ? element.Content.ToString() : string.Empty;
             offset = WrapElement(parent, ref p, offset, text, element, align);
         }
         else if (element.CaptionElementType == TimedTextElementType.Container)
         {
             foreach (CaptionElement child in element.Children)
             {
                 RenderElementRecurse(parent, ref p, child, ref offset, align);
             }
         }
         else if (element.CaptionElementType == TimedTextElementType.LineBreak)
         {
             p = NewPanel(parent, ref offset, element, align);
         }
     }
 }