/// <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); }
public void AddComponent(Component component) { if (components.Contains(component)) { return; } components.Add(component); RaisePropertyChanged("Components"); ComponentsChanged.RaiseAdditionEventEx(this, component); }
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); }
public void RemoveComponent <T>() where T : IComponent { components.Remove(typeof(T)); ComponentsChanged?.Invoke(this, EventArgs.Empty); }
public void AddComponent(IComponent component) { components[component.GetType()] = component; ComponentsChanged?.Invoke(this, EventArgs.Empty); }