Exemple #1
0
        public void RecomputeComponents()
        {
            this.Components.Clear();

            string renderText = this.FileReference.SortKey;

            int offset = (HighlightSubstring.Length == 0) ? -1 : renderText.IndexOf(HighlightSubstring, StringComparison.OrdinalIgnoreCase);

            while (offset >= 0)
            {
                AddSegment(renderText.Substring(0, offset), highlight: false);
                AddSegment(renderText.Substring(offset, HighlightSubstring.Length), highlight: true);

                renderText = renderText.Substring(offset + HighlightSubstring.Length);
                offset     = renderText.IndexOf(HighlightSubstring, StringComparison.OrdinalIgnoreCase);
            }

            if (renderText.Length > 0)
            {
                AddSegment(renderText, highlight: false);
            }

            ComponentsChanged?.Invoke(this, EventArgs.Empty);
        }
Exemple #2
0
 public void RemoveComponent <T>() where T : IComponent
 {
     components.Remove(typeof(T));
     ComponentsChanged?.Invoke(this, EventArgs.Empty);
 }
Exemple #3
0
 public void AddComponent(IComponent component)
 {
     components[component.GetType()] = component;
     ComponentsChanged?.Invoke(this, EventArgs.Empty);
 }