Пример #1
0
 void captionManager_MarkerLeft(IMarkerManager <CaptionRegion> markerManager, CaptionRegion region)
 {
     if (regions.ContainsKey(region))
     {
         var presenter = regions[region];
         CaptionsPresenterElement.Children.Remove(presenter);
         VisibleCaptions.Remove(region);
         regions.Remove(region);
         presenter.CaptionManager = null;
     }
     OnCaptionRegionLeft(region);
 }
Пример #2
0
        private static CaptionRegion MapToCaptionRegion(RegionElement regionElement)
        {
            var endTime = regionElement.End.TotalSeconds >= TimeSpan.MaxValue.TotalSeconds
                            ? TimeSpan.MaxValue
                            : TimeSpan.FromSeconds(regionElement.End.TotalSeconds);

            var captionRegion = new CaptionRegion
            {
                Id           = regionElement.Id,
                Begin        = TimeSpan.FromSeconds(regionElement.Begin.TotalSeconds),
                End          = endTime,
                Style        = TimedTextStyleParser.MapStyle(regionElement, null),
                TunneledData = regionElement.Root.Images.ToDictionary(ie => ie.Key, ie => new TunneledData()
                {
                    Data = ie.Value.Data, Encoding = ie.Value.Encoding, MimeType = ie.Value.ImageType
                })
            };



            foreach (TimedTextElementBase element in regionElement.Children)
            {
                TimedTextElement child = BuildTimedTextElements(element, null);
                if (child != null && child.CaptionElementType == TimedTextElementType.Animation)
                {
#if HACK_XAMLTYPEINFO
                    var children = captionRegion.Animations as MediaMarkerCollection <TimedTextAnimation>;
#else
                    var children = captionRegion.Animations;
#endif
                    children.Add(child as TimedTextAnimation);
                }
            }

            return(captionRegion);
        }
        private static CaptionRegion MapToCaptionRegion(RegionElement regionElement)
        {
            var endTime = regionElement.End.TotalSeconds >= TimeSpan.MaxValue.TotalSeconds
                            ? TimeSpan.MaxValue
                            : TimeSpan.FromSeconds(regionElement.End.TotalSeconds);

            var captionRegion = new CaptionRegion
            {
                Id = regionElement.Id,
                Begin = TimeSpan.FromSeconds(regionElement.Begin.TotalSeconds),
                End = endTime,
                Style = TimedTextStyleParser.MapStyle(regionElement, null),
                TunneledData = regionElement.Root.Images.ToDictionary(ie => ie.Key, ie => new TunneledData() { Data = ie.Value.Data, Encoding = ie.Value.Encoding, MimeType = ie.Value.ImageType })
            };



            foreach (TimedTextElementBase element in regionElement.Children)
            {
                TimedTextElement child = BuildTimedTextElements(element, null);
                if (child != null && child.CaptionElementType == TimedTextElementType.Animation)
                {
#if HACK_XAMLTYPEINFO
                    var children = captionRegion.Animations as MediaMarkerCollection<TimedTextAnimation>;
#else
                    var children = captionRegion.Animations;
#endif
                    children.Add(child as TimedTextAnimation);
                }
            }

            return captionRegion;
        }
 public CaptionRegionEventArgs(CaptionRegion captionRegion)
 {
     CaptionRegion = captionRegion;
 }
 /// <summary>
 /// Raises the CaptionReached event.
 /// </summary>
 protected virtual void OnCaptionRegionReached(CaptionRegion region)
 {
     CaptionReached.IfNotNull(i => i(this, new CaptionRegionEventArgs(region)));
 }
 void captionManager_MarkerLeft(IMarkerManager<CaptionRegion> markerManager, CaptionRegion region)
 {
     if (regions.ContainsKey(region))
     {
         var presenter = regions[region];
         CaptionsPresenterElement.Children.Remove(presenter);
         VisibleCaptions.Remove(region);
         regions.Remove(region);
         presenter.CaptionManager = null;
     }
     OnCaptionRegionLeft(region);
 }
        void captionManager_MarkerReached(IMarkerManager<CaptionRegion> markerManager, CaptionRegion region)
        {
            OnCaptionRegionReached(region);
            if (!regions.ContainsKey(region))
            {
#if HACK_XAMLTYPEINFO
                var children = region.Children as MediaMarkerCollection<TimedTextElement>;
#else
                var children = region.Children;
#endif
                var regionBlock = new CaptionBlockRegion();
                if (CaptionBlockRegionStyle != null) regionBlock.Style = CaptionBlockRegionStyle;
                regionBlock.CaptionRegion = region;
                regionBlock.CaptionManager = regionManagerFactory(children);
                regions.Add(region, regionBlock);
                CaptionsPresenterElement.Children.Add(regionBlock);
                regionBlock.ApplyTemplate();
                VisibleCaptions.Add(region);
            }
        }
Пример #8
0
 public CaptionRegionEventArgs(CaptionRegion captionRegion)
 {
     CaptionRegion = captionRegion;
 }
Пример #9
0
 /// <summary>
 /// Raises the CaptionReached event.
 /// </summary>
 protected virtual void OnCaptionRegionReached(CaptionRegion region)
 {
     CaptionReached.IfNotNull(i => i(this, new CaptionRegionEventArgs(region)));
 }
Пример #10
0
        void captionManager_MarkerReached(IMarkerManager <CaptionRegion> markerManager, CaptionRegion region)
        {
            OnCaptionRegionReached(region);
            if (!regions.ContainsKey(region))
            {
#if HACK_XAMLTYPEINFO
                var children = region.Children as MediaMarkerCollection <TimedTextElement>;
#else
                var children = region.Children;
#endif
                var regionBlock = new CaptionBlockRegion();
                if (CaptionBlockRegionStyle != null)
                {
                    regionBlock.Style = CaptionBlockRegionStyle;
                }
                regionBlock.CaptionRegion  = region;
                regionBlock.CaptionManager = regionManagerFactory(children);
                regions.Add(region, regionBlock);
                CaptionsPresenterElement.Children.Add(regionBlock);
                regionBlock.ApplyTemplate();
                VisibleCaptions.Add(region);
            }
        }