private bool TryLoadFile(IMainWindowViewModel viewModel, IViewModelStateSerializer serializer, string filePath)
        {
            try
            {
                serializer.LoadViewModelState(viewModel, filePath);
            }
            catch (InvalidOperationException)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        private void OnDeserializeViewModelState()
        {
            var filePath = FileManagerHelper.GetFileNameToOpen();

            if (String.IsNullOrWhiteSpace(filePath))
            {
                return;
            }

            _viewModelStateSerializer.LoadViewModelState(this, filePath);

            // updating event aggregator in loaded configuration for enabling event tracking
            TestConfiguration.UpdateConfiguration(ref _configuration, _eventAggregator);

            _eventAggregator.GetEvent <CameraPositionChangedEvent>().Unsubscribe(_cameraSubscriptionToken);
            _eventAggregator.GetEvent <CameraPositionChangedEvent>().Publish(Configuration.Camera);
            _cameraSubscriptionToken = _eventAggregator.GetEvent <CameraPositionChangedEvent>().Subscribe(OnCameraChange);

            if (State == TestState.TestIsFinished)
            {
                _models.ExecuteWithoutNotification(models => models.ForEach(model => model.ApplyFinalVisualState()));
                RaisePropertyChanged(() => Models3D);
            }
        }