예제 #1
0
        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);
        }
예제 #2
0
        //Constructor
        public MainWindowViewModel(IDialogCoordinator dialogCoordinator, Model3DCollection sphereContainer, Model3DCollection detailsSphereContainer)
        {
            // Dialog coordinator provided by Mahapps framework
            // Either passed into MainViewModel constructor to conform to MVVM:-

            _dialogCoordinator          = dialogCoordinator;
            sphereService               = new SphereClientService();
            sphereDrawService           = new SphereDrawService();
            persistanceService          = new PersistanceService();
            this.sphereContainer        = sphereContainer;
            this.detailsSphereContainer = detailsSphereContainer;

            initSpheresFromApplicationState(PersistanceService.getApplicationState().Spheres);

            // if was loaded from state
        }