protected override void TypedDeserialize(MoBiSimulation simulation, XElement outputToDeserialize, SerializationContext serializationContext)
        {
            base.TypedDeserialize(simulation, outputToDeserialize, serializationContext);

            if (simulation.Results != null)
            {
                serializationContext.AddRepository(simulation.Results);
            }

            var chartSerializer = SerializerRepository.SerializerFor <CurveChart>();
            var chartElement    = outputToDeserialize.Element(chartSerializer.ElementName);

            if (chartElement != null)
            {
                simulation.Chart = chartSerializer.Deserialize <CurveChart>(outputToDeserialize.Element(chartSerializer.ElementName), serializationContext);
            }

            var diagramSerializer = serializationContext.Resolve <IDiagramModelToXmlMapper>();

            var diagramElement = outputToDeserialize.Element(diagramSerializer.ElementName);

            if (diagramElement != null)
            {
                simulation.DiagramModel = diagramSerializer.XmlDocumentToDiagramModel(diagramElement.ToXmlDocument());
            }
        }
 private void addObservedDataToSerializationContext(SerializationContext serializationContext)
 {
     _project.AllObservedData.Each(x =>
     {
         serializationContext.AddRepository(x);
         serializationContext.Register(x);
     });
 }
        private void addSimulationToProject(SimulationMetaData simulationMetaData, SerializationContext serializationContext)
        {
            var simulation = deserializeContent <IMoBiSimulation>(simulationMetaData.Content, serializationContext);

            _project.AddSimulation(simulation);
            deserializeResults(simulation, simulationMetaData, serializationContext);
            //Ensure that all references to simulations (Simulation itself, results etc) are available in the serialization context
            serializationContext.AddRepository(simulation.Results);
            simulation.HistoricResults.Each(serializationContext.AddRepository);
            serializationContext.Register(simulation);
        }