private void initSpheresFromApplicationState(ObservableCollection <Sphere> spheres) { this.spheres = PersistanceService.getApplicationState().Spheres; if (spheres.Count() > 0) { foreach (Sphere sphere in spheres) { sphere.setColor((Color)ColorConverter.ConvertFromString(sphere.getColorStr())); sphereDrawService.draw(sphereContainer, sphere, currentSphereGenerationOffsetX); currentSphereGenerationOffsetX += sphere.radius + SPHERE_GENERATION_OFFSET_X; } } Console.WriteLine("initialized state {0}", spheres); }