Ejemplo n.º 1
0
        private static void OnHighlighterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            HighlightedTagsPanel panel = d as HighlightedTagsPanel;

            if (panel != null)
            {
                ITagSource tagsource = panel.TagSource;
                if (tagsource != null)
                {
                    TextSplitter highlighter = e.NewValue as TextSplitter;
                    if (highlighter == null)
                    {
                        highlighter = new TextSplitter();
                    }

                    bool firstMatch = false;
                    int  i          = 0;
                    foreach (IHighlightableTagDataContext ctx in tagsource.TagDataContextCollection)
                    {
                        ctx.Highlighter = highlighter;
                        Control ctrl = (Control)panel.tagsPanel.Children[i];
                        if (!firstMatch && ctx.HasHighlights)
                        {
                            ctrl.BringIntoView();
                            firstMatch = true;
                        }
                        ctrl.Focusable = ctx.HasHighlights;
                        i++;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds all tags from <paramref name="tagSource"/> as children of the current tag. Returns the parent tag.
 /// </summary>
 /// <param name="tagSource">The source of tags to add as children.</param>
 /// <returns>The parent tag</returns>
 protected internal virtual void Append(ITagSource tagSource)
 {
     tagSource.AllTags().Each(x =>
     {
         x.Parent = this;
         _children.Add(x);
     });
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds all tags from <paramref name="tagSource"/> as children of the current tag. Returns the parent tag.
 /// </summary>
 /// <param name="tagSource">The source of tags to add as children.</param>
 /// <returns>The parent tag</returns>
 public HtmlTag Append(ITagSource tagSource)
 {
     tagSource.AllTags().Each(x =>
     {
         x._parent = this;
         _children.Add(x);
     });
     return(this);
 }
        public virtual void Initialize(MediaWorkflowStateType stateType, IPlayer player)
        {
            _mediaWorkflowStateType = stateType;
            _tagSource        = player as ITagSource;
            CurrentStreamLogo = WebradioHome.CurrentStreamLogo;

            // Only for Fanart /////////////
            ATimer.Elapsed += OnTimedEvent;
            ATimer.Interval = 15000;
            ATimer.Start();
            ////////////////////////////////
        }
Ejemplo n.º 5
0
        public RipperService(RipperNotificator notificator, Persister <RipperSettings> settings, ILogger logger)
        {
            _notificator = notificator;
            _settings    = settings;
            _logger      = logger;
            _tagSource   = new MusicBrainzTagSource(new MusicBrainzApi("http://musicbrainz.org"), new CoverArtArchiveApi("http://coverartarchive.org"));
            _tracker     = new StatusTracker();

            _tracker.OnStatusUpdated   += s => _notificator.UpdateStatus(s);
            _tracker.OnRippingProgress += (t, p) => _notificator.UpdateProgress(t, p);

            _tracker.OnDiscInserted  += d => IdentifyAlbum(d, true);
            _tracker.OnAlbumSelected += (d, a) => StartRipping(d, a);
        }
Ejemplo n.º 6
0
        public TAG_INFO GetTags()
        {
            PlaybackSession session = _playbackProcessor.PlaybackSession;

            if (session == null)
            {
                return(null);
            }
            ITagSource source = session.CurrentInputSource as ITagSource;

            if (source == null)
            {
                return(null);
            }
            return(source.Tags);
        }
Ejemplo n.º 7
0
        private static void OnTagSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            HighlightedTagsPanel panel = d as HighlightedTagsPanel;

            if (d != null)
            {
                ITagSource old = e.OldValue as ITagSource;
                if (old != null)
                {
                    old.CollectionChanged -= panel.OnTagdataContextCollectionChanged;
                }
                ITagSource newTagSource = e.NewValue as ITagSource;
                if (newTagSource != null)
                {
                    newTagSource.CollectionChanged += panel.OnTagdataContextCollectionChanged;
                    panel.OnTagdataContextCollectionChanged(newTagSource, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
                }
            }
        }
Ejemplo n.º 8
0
        private void OnTagdataContextCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            ITagSource tagsource = sender as ITagSource;

            if (tagsource != null)
            {
                switch (e.Action)
                {
                case NotifyCollectionChangedAction.Add:
                    DataTemplate tpl          = TagTemplate;
                    int          newItemCount = e.NewItems.Count;
                    TextSplitter highlighter  = Highlighter;
                    for (int i = 0; i < newItemCount; i++)
                    {
                        FrameworkElement             tagControl = tpl.LoadContent() as FrameworkElement;
                        IHighlightableTagDataContext ctx        = e.NewItems[i] as IHighlightableTagDataContext;
                        if (ctx != null)
                        {
                            ctx.Highlighter        = highlighter;
                            tagControl.DataContext = ctx;
                        }

                        tagsPanel.Children.Insert(i + e.NewStartingIndex, tagControl);
                    }
                    break;

                case NotifyCollectionChangedAction.Remove:
                    int oldItemCount = e.OldItems.Count;
                    for (int i = 0; i < oldItemCount; i++)
                    {
                        tagsPanel.Children.RemoveAt(e.OldStartingIndex);
                    }
                    break;

                case NotifyCollectionChangedAction.Reset:
                    tagsPanel.Children.Clear();
                    break;
                }
            }
        }
Ejemplo n.º 9
0
 public void Add(ITagSource source)
 {
     source.AllTags().Each(Add);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Adds all tags from <paramref name="tagSource"/> as children of the current tag. Returns the parent tag.
 /// </summary>
 /// <param name="tagSource">The source of tags to add as children.</param>
 /// <returns>The parent tag</returns>
 public HtmlTag Append(ITagSource tagSource)
 {
     _children.AddRange(tagSource.AllTags());
     return(this);
 }
Ejemplo n.º 11
0
 public static HtmlTag ForChild(this ITagSource parent, string tagName)
 {
     return(parent.AllTags().First(child => child.TagName().EqualsIgnoreCase(tagName)));
 }
Ejemplo n.º 12
0
 public void Add(ITagSource source)
 {
     source.AllTags().Each(Add);
 }
Ejemplo n.º 13
0
        public virtual void Initialize(MediaWorkflowStateType stateType, IPlayer player)
        {
            _mediaWorkflowStateType = stateType;
            _tagSource = player as ITagSource;
            CurrentStreamLogo = WebradioHome.CurrentStreamLogo;

            // Only for Fanart /////////////
            ATimer.Elapsed += OnTimedEvent;
            ATimer.Interval = 15000;
            ATimer.Start();
            ////////////////////////////////
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Adds all tags from <paramref name="tagSource" /> as children of the current tag. Returns the parent tag.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="tag">The tag.</param>
 /// <param name="tagSource">The source of tags to add as children.</param>
 /// <returns>
 /// The parent tag
 /// </returns>
 public static T AppendHtml <T>(this T tag, ITagSource tagSource) where T : HtmlTag
 {
     tag.Append(tagSource);
     return(tag);
 }
Ejemplo n.º 15
0
 public void append(ITagSource htmlTag)
 {
     _currentScope.Peek().Append(htmlTag);
 }
Ejemplo n.º 16
0
 public void Append(ITagSource htmlTag)
 {
     _children.Add(htmlTag);
 }