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++; } } } }
/// <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); }); }
/// <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(); //////////////////////////////// }
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); }
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); }
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)); } } }
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; } } }
public void Add(ITagSource source) { source.AllTags().Each(Add); }
/// <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); }
public static HtmlTag ForChild(this ITagSource parent, string tagName) { return(parent.AllTags().First(child => child.TagName().EqualsIgnoreCase(tagName))); }
/// <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); }
public void append(ITagSource htmlTag) { _currentScope.Peek().Append(htmlTag); }
public void Append(ITagSource htmlTag) { _children.Add(htmlTag); }