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);
        }
Exemplo n.º 2
0
        private TabPageInfo AddReportFile(string fileName, bool editable)
        {
            TabPage newTabPage = new TabPage(Path.GetFileName(fileName));

            this.reportFilesTabControl.TabPages.Add(newTabPage);

            Button removeReportFileButton = new Button();

            removeReportFileButton.Text     = "Remove this report file";
            removeReportFileButton.AutoSize = true;

            removeReportFileButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            int rightOffset  = removeReportFileButton.Margin.Right + newTabPage.Padding.Right;
            int bottomOffset = removeReportFileButton.Margin.Bottom + newTabPage.Padding.Bottom;

            removeReportFileButton.Location = new Point(
                newTabPage.Width - removeReportFileButton.Width - rightOffset,
                newTabPage.Height - removeReportFileButton.Height - bottomOffset);

            removeReportFileButton.Tag    = newTabPage;
            removeReportFileButton.Click += new EventHandler(RemoveReportFileButtonClick);

            newTabPage.Controls.Add(removeReportFileButton);

            ReportWriterConfigurationControl reportWriterControl = new ReportWriterConfigurationControl(
                ReportTrigger.GetReportTriggers().ToArray(),
                DataAccumulator.GetDataAccumulators().ToArray(),
                this.Experiment,
                editable);

            reportWriterControl.Dock = DockStyle.Top;

            newTabPage.Controls.Add(reportWriterControl);

            TabPageInfo tabPageInfo = new TabPageInfo()
            {
                FileName            = fileName,
                ReportWriterControl = reportWriterControl
            };

            newTabPage.Tag = tabPageInfo;

            newTabPage.Select();

            return(tabPageInfo);
        }