internal static void RemoveFromSpaceObjects(SpaceObject selected) { if (SpaceObjects.Exists(x => x.Name == selected.Name)) { SpaceObjects.Remove(selected); OnSpaceObjectsItemsChanged(); } }
private void Remove(ISpaceObject so) { canvas.Children.Remove(so.GetImage()); if (so is Planet p) { Planets.Remove(p); } if (so is Asteroid a) { Asteroids.Remove(a); } SpaceObjects.Remove(so); }