Example #1
0
 /// <summary>
 /// Just removes the component from this entity, not
 /// completely.
 /// </summary>
 /// <param name="component"></param>
 public void RemoveComponent(Component component)
 {
     components.Remove(component);
     component.Specification.RemoveImplementation(component);
     RaisePropertyChanged("Components");
     ComponentsChanged.RaiseDeletionEventEx(this, component);
 }
Example #2
0
        public void AddComponent(Component component)
        {
            if (components.Contains(component))
            {
                return;
            }

            components.Add(component);
            RaisePropertyChanged("Components");
            ComponentsChanged.RaiseAdditionEventEx(this, component);
        }
Example #3
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);
        }
Example #4
0
 public void RemoveComponent <T>() where T : IComponent
 {
     components.Remove(typeof(T));
     ComponentsChanged?.Invoke(this, EventArgs.Empty);
 }
Example #5
0
 public void AddComponent(IComponent component)
 {
     components[component.GetType()] = component;
     ComponentsChanged?.Invoke(this, EventArgs.Empty);
 }