public ExperimentBase ToExperiment()
        {
            Component environment = EnvironmentRegistry
                                    .GetEnvironments()
                                    .Single(t => t.FullName.Equals(this.EnvironmentTypeName))
                                    .InstantiateWithDefaultConstructor <Component>();

            Component presentationEnvironment = environment.Clone();

            Component agent = AgentRegistry
                              .GetAgents(environment.ComponentType)
                              .Single(t => t.FullName.Equals(this.AgentTypeName))
                              .InstantiateWithDefaultConstructor <Component>();

            ExperimentBase result = ExperimentBase.Instantiate(environment, presentationEnvironment, agent);

            result.SetParametersFromSnapshot(this.ExperimentParameters);
            environment.SetParametersFromSnapshotWithInnerObjects(this.EnvironmentParameters);
            presentationEnvironment.SetParametersFromSnapshotWithInnerObjects(this.EnvironmentParameters);
            agent.SetParametersFromSnapshotWithInnerObjects(this.AgentParameters);

            result.Reporter = this.ReporterTemplate.ToReporter(
                ReportTrigger.GetReportTriggers().ToArray(),
                DataSource.GetDataSources(result).ToArray(),
                DataAccumulator.GetDataAccumulators().ToArray());

            return(result);
        }
Ejemplo n.º 2
0
        private void RebuildLists()
        {
            this.agentListView.Items.Clear();
            this.environmentListView.Items.Clear();

            this.agentListView.Items.AddRange(AgentRegistry
                                              .GetAgents(GetCurrentComponentType())
                                              .Select(type => new ListViewItem(type.Name)
            {
                Tag = type
            })
                                              .ToArray());
            this.environmentListView.Items.AddRange(EnvironmentRegistry
                                                    .GetEnvironments(GetCurrentComponentType())
                                                    .Select(type => new ListViewItem(type.Name)
            {
                Tag = type
            })
                                                    .ToArray());
        }