/// <summary>Attach the model (report) and the view (IReportView)</summary> public void Attach(object Model, object View, ExplorerPresenter explorerPresenter) { this.report = Model as Report; this.explorerPresenter = explorerPresenter; this.view = View as IReportView; this.view.VariableList.Lines = report.VariableNames; this.view.EventList.Lines = report.EventNames; this.view.VariableList.ContextItemsNeeded += OnNeedVariableNames; this.view.EventList.ContextItemsNeeded += OnNeedEventNames; this.view.VariableList.TextHasChangedByUser += OnVariableNamesChanged; this.view.EventList.TextHasChangedByUser += OnEventNamesChanged; this.explorerPresenter.CommandHistory.ModelChanged += OnModelChanged; Simulations simulations = Apsim.Parent(report, typeof(Simulations)) as Simulations; dataStore = Apsim.Child(simulations, typeof(DataStore)) as DataStore; this.view.VariableList.SetSyntaxHighlighter("Report"); dataStorePresenter = new DataStorePresenter(); dataStorePresenter.Attach(dataStore, this.view.DataStoreView, explorerPresenter); this.view.DataStoreView.TableList.SelectedValue = this.report.Name; Simulation simulation = Apsim.Parent(report, typeof(Simulation)) as Simulation; if (simulation != null) { if (simulation.Parent is Experiment) dataStorePresenter.ExperimentFilter = simulation.Parent as Experiment; else dataStorePresenter.SimulationFilter = simulation; dataStorePresenter.PopulateGrid(); } }
/// <summary> /// Attach the model (report) and the view (IReportView) /// </summary> public void Attach(object Model, object View, ExplorerPresenter explorerPresenter) { this.Report = Model as Report; this.ExplorerPresenter = explorerPresenter; this.View = View as IReportView; this.View.VariableList.Lines = Report.VariableNames; this.View.EventList.Lines = Report.EventNames; this.View.VariableList.ContextItemsNeeded += OnNeedVariableNames; this.View.EventList.ContextItemsNeeded += OnNeedEventNames; this.View.VariableList.TextHasChangedByUser += OnVariableNamesChanged; this.View.EventList.TextHasChangedByUser += OnEventNamesChanged; ExplorerPresenter.CommandHistory.ModelChanged += CommandHistory_ModelChanged; Simulation simulation = Apsim.Parent(Report, typeof(Simulation)) as Simulation; DataStore = new DataStore(Report); this.View.VariableList.SetSyntaxHighlighter("Report"); PopulateDataGrid(); this.View.DataGrid.ResizeControls(); }