/// <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 IReportActivityLedgerView; this.explorerPresenter.CommandHistory.ModelChanged += OnModelChanged; Simulations simulations = Apsim.Parent(report, typeof(Simulations)) as Simulations; if (simulations != null) { dataStore = Apsim.Child(simulations, typeof(IDataStore)) as IDataStore; } dataStorePresenter = new DataStorePresenter(); activityGridPresenter = new ActivityLedgerGridPresenter(); Simulation simulation = Apsim.Parent(report, typeof(Simulation)) as Simulation; Zone paddock = Apsim.Parent(report, typeof(Zone)) as Zone; if (paddock != null) { dataStorePresenter.ZoneFilter = paddock; } if (simulation != null) { if (simulation.Parent is Experiment) { dataStorePresenter.ExperimentFilter = simulation.Parent as Experiment; } else { dataStorePresenter.SimulationFilter = simulation; } } dataStorePresenter.Attach(dataStore, this.view.DataStoreView, explorerPresenter); activityGridPresenter.ModelName = this.report.Name; activityGridPresenter.SimulationName = simulation.Name; activityGridPresenter.ZoneName = paddock.Name; activityGridPresenter.Attach(dataStore, this.view.DisplayView, explorerPresenter); dataStorePresenter.tableDropDown.SelectedValue = this.report.Name; }
/// <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 IReportActivityLedgerView; this.explorerPresenter.CommandHistory.ModelChanged += OnModelChanged; Simulations simulations = Apsim.Parent(report, typeof(Simulations)) as Simulations; if (simulations != null) { dataStore = Apsim.Child(simulations, typeof(IStorageReader)) as IStorageReader; } /// TBI this.view.VariableList.SetSyntaxHighlighter("Report"); dataStorePresenter = new DataStorePresenter(); activityGridPresenter = new ActivityLedgerGridPresenter(); 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.Attach(dataStore, this.view.DataStoreView, explorerPresenter); activityGridPresenter.ModelName = this.report.Name; activityGridPresenter.Attach(dataStore, this.view.DisplayView, explorerPresenter); this.view.DataStoreView.TableList.SelectedValue = this.report.Name; }