public bool Add(SiDComponent component) { if (component == null) return false; String compUIDStr = component.getUID().ToString(); // check for duplicates if (mComponentsByUID.ContainsKey(compUIDStr)) { return false; } mComponentsByUID.Add(compUIDStr, component); mComponents.Add(component); mComponentsByType.Add(component.GetType(), component); // ping event handler if (ComponentAdded != null) ComponentAdded(this, component); return true; }
public bool Remove(SiDComponent component) { if (component == null) return false; String compUIDStr = component.getUID().ToString(); if (mComponentsByUID.ContainsKey(compUIDStr)) { mComponents.Remove(component); mComponentsByUID.Remove(compUIDStr); mComponentsByType[component.GetType()].Remove(component); // ping event handler if (ComponentRemoved != null) ComponentRemoved(this, component); return true; } return false; }