/// <summary> /// Attaches the model to the view. /// </summary> /// <param name="model">The BiomassRemoval model to connect.</param> /// <param name="view">The view. Should be a <see cref="GridView"/>.</param> /// <param name="explorerPresenter">The explorer presenter controlling this presenter.</param> public override void Attach(object model, object view, ExplorerPresenter explorerPresenter) { if (!(model is BiomassRemoval)) { throw new Exception(string.Format("{0} cannot be used to display a model of type {1}.", GetType().Name, model.GetType().Name)); } base.Attach(model, view, explorerPresenter); this.model = model as BiomassRemoval; grid.CanGrow = false; DataTable data = new DataTable(); List <IModel> removalTypes = Apsim.Children(model as IModel, typeof(OrganBiomassRemovalType)).ToList(); bool hasData = removalTypes.Any(); data.Columns.Add(hasData ? "Description" : "No values are currently available", typeof(string)); data.Columns.Add(hasData ? "Value" : " ", typeof(object)); foreach (IModel child in removalTypes) { data.Rows.Add(child.Name, " "); grid.SetRowAsSeparator(data.Rows.Count - 1); PropertyPresenter propertyHandler = new PropertyPresenter(); propertyHandler.FindAllProperties(child as Model); propertyHandler.FillTable(data); } grid.DataSource = data; grid.GetColumn(0).ReadOnly = true; grid.CellsChanged += OnGridChanged; }
/// <summary> /// Attaches the model to the view. /// </summary> /// <param name="model">The model.</param> /// <param name="view">The view.</param> /// <param name="explorerPresenter">The explorer presenter.</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.view = view as IGraphPanelView; this.panel = model as GraphPanel; this.presenter = explorerPresenter; graphs = new List <GraphTab>(); if (this.view == null || this.panel == null || this.presenter == null) { throw new ArgumentException(); } presenter.CommandHistory.ModelChanged += OnModelChanged; this.view.GraphViewCreated += ModifyGraphView; properties = new PropertyPresenter(); properties.Attach(panel, this.view.PropertiesView, presenter); processingThread = new BackgroundWorker(); processingThread.DoWork += WorkerThread; processingThread.RunWorkerCompleted += OnProcessingFinished; processingThread.WorkerSupportsCancellation = true; processingThread.RunWorkerAsync(); }
/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The underlying model we are to use</param> /// <param name="view">The underlying view we are to attach to</param> /// <param name="explorerPresenter">Our parent explorerPresenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.model = model as Model; this.view = view as IProfileView; this.explorerPresenter = explorerPresenter; this.view.ShowView(false); // Setup the property presenter and view. Hide the view if there are no properties to show. this.propertyPresenter = new PropertyPresenter(); this.propertyPresenter.Attach(this.model, this.view.PropertyGrid, this.explorerPresenter); // Create a list of profile (array) properties. Create a table from them and // hand the table to the profile grid. this.FindAllProperties(this.model); // Populate the grid this.PopulateGrid(); // Populate the graph. this.graph = Utility.Graph.CreateGraphFromResource(model.GetType().Name + "Graph"); if (this.graph == null) { this.view.ShowGraph(false); } else { parentForGraph = this.model.Parent as IModel; if (this.parentForGraph != null) { this.parentForGraph.Children.Add(this.graph); this.graph.Parent = this.parentForGraph; this.view.ShowGraph(true); int padding = (this.view as ProfileView).MainWidget.Allocation.Width / 2 / 2; this.view.Graph.LeftRightPadding = padding; this.graphPresenter = new GraphPresenter(); this.graphPresenter.Attach(this.graph, this.view.Graph, this.explorerPresenter); } } // Trap the invoking of the ProfileGrid 'CellValueChanged' event so that // we can save the contents. this.view.ProfileGrid.CellsChanged += this.OnProfileGridCellValueChanged; // Trap the right click on column header so that we can potentially put // units on the context menu. this.view.ProfileGrid.ColumnHeaderClicked += this.OnColumnHeaderClicked; // Trap the model changed event so that we can handle undo. this.explorerPresenter.CommandHistory.ModelChanged += this.OnModelChanged; this.view.ProfileGrid.ResizeControls(); this.view.PropertyGrid.ResizeControls(); this.view.ShowView(true); }
public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { ForestryModel = model as TreeProxy; ForestryViewer = view as TreeProxyView; AttachData(); ForestryViewer.OnCellEndEdit += OnCellEndEdit; ForestryViewer.SetReadOnly(); this.propertyPresenter = new PropertyPresenter(); this.propertyPresenter.Attach(ForestryModel, ForestryViewer.ConstantsGrid, explorerPresenter); }
public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { ForestryModel = model as TreeProxy; ForestryViewer = view as TreeProxyView; AttachData(); ForestryViewer.OnCellEndEdit += OnCellEndEdit; ForestryViewer.SetReadOnly(); this.propertyPresenter = new PropertyPresenter(); this.propertyPresenter.Attach(ForestryModel, ForestryViewer.ConstantsGrid, explorerPresenter); }
/// <summary> /// Attach the presenter to the model and view. /// </summary> /// <param name="model">The model object.</param> /// <param name="view">The view object.</param> /// <param name="explorerPresenter">The explorer presenter.</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { forestryModel = model as TreeProxy; forestryViewer = view as TreeProxyView; presenter = explorerPresenter; AttachData(); forestryViewer.OnCellEndEdit += OnCellEndEdit; presenter.CommandHistory.ModelChanged += OnModelChanged; propertyPresenter = new PropertyPresenter(); propertyPresenter.Attach(forestryModel, forestryViewer.ConstantsGrid, explorerPresenter); spatialGridPresenter.Attach(forestryModel, forestryViewer.SpatialDataGrid, explorerPresenter); temporalGridPresenter.Attach(forestryModel, forestryViewer.TemporalDataGrid, explorerPresenter); }
/// <summary> /// Attach the view to this presenter and begin populating the view. /// </summary> /// <param name="model">The simulation model</param> /// <param name="view">The view used for display</param> /// <param name="explorerPresenter">The presenter for this object</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.model = model as Model; this.treeview = view as IPropertyTreeView; this.TreeWidth = explorerPresenter.TreeWidth; //set the width of the PropertyTreeView to the same as the Explorer Tree. this.treeview.SelectedNodeChanged += this.OnNodeSelected; this.explorerPresenter = explorerPresenter; //Fill in the nodes in the tree view this.RefreshTreeView(); //Initialise the Right Hand View this.propertyPresenter = new PropertyPresenter(); this.ShowRightHandView(); }
/// <summary> /// Attach the specified Model and View. /// </summary> /// <param name="model">The model</param> /// <param name="view">The view</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.map = model as Map; this.view = view as MapView; this.explorerPresenter = explorerPresenter; propertyPresenter = new PropertyPresenter(); propertyPresenter.Attach(model, this.view.Grid, this.explorerPresenter); // Tell the view to populate the axis. this.PopulateView(); this.view.Zoom = this.map.Zoom; this.view.Center = this.map.Center; this.view.ViewChanged += this.OnViewChanged; explorerPresenter.CommandHistory.ModelChanged += OnModelChanged; }
/// <summary> /// Attach the Manager model and ManagerView to this presenter. /// </summary> /// <param name="model">The model</param> /// <param name="view">The view to attach</param> /// <param name="presenter">The explorer presenter being used</param> public void Attach(object model, object view, ExplorerPresenter presenter) { manager = model as Manager; managerView = view as IManagerView; explorerPresenter = presenter; intellisense = new IntellisensePresenter(managerView as ViewBase); intellisense.ItemSelected += OnIntellisenseItemSelected; scriptModel = manager.Children.FirstOrDefault(); // See if manager script has a description attribute on it's class. if (scriptModel != null) { DescriptionAttribute descriptionName = ReflectionUtilities.GetAttribute(scriptModel.GetType(), typeof(DescriptionAttribute), false) as DescriptionAttribute; if (descriptionName != null) { explorerPresenter.ShowDescriptionInRightHandPanel(descriptionName.ToString()); } } propertyPresenter = new PropertyPresenter(); try { propertyPresenter.Attach(scriptModel, managerView.PropertyEditor, presenter); } catch (Exception err) { explorerPresenter.MainPresenter.ShowError(err); } managerView.Editor.Mode = EditorType.ManagerScript; managerView.Editor.Text = manager.Code; #if NETFRAMEWORK // In gtk3 builds, the gtksourceview completion infrastructure // handles all of the completion functionality internally. managerView.Editor.ContextItemsNeeded += OnNeedVariableNames; #endif managerView.Editor.LeaveEditor += OnEditorLeave; managerView.Editor.AddContextSeparator(); managerView.Editor.AddContextActionWithAccel("Test compile", OnDoCompile, "Ctrl+T"); managerView.Editor.AddContextActionWithAccel("Reformat", OnDoReformat, "Ctrl+R"); managerView.Editor.Location = manager.Location; managerView.TabIndex = manager.ActiveTabIndex; presenter.CommandHistory.ModelChanged += CommandHistory_ModelChanged; }
/// <summary> /// Attaches the model to the view. /// </summary> /// <param name="model">The model.</param> /// <param name="view">The view.</param> /// <param name="explorerPresenter">The explorer presenter.</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.view = view as IGraphPanelView; this.panel = model as GraphPanel; this.presenter = explorerPresenter; graphs = new List <GraphTab>(); if (this.view == null || this.panel == null || this.presenter == null) { throw new ArgumentException(); } presenter.CommandHistory.ModelChanged += OnModelChanged; this.view.GraphViewCreated += ModifyGraphView; properties = new PropertyPresenter(); properties.Attach(panel, this.view.PropertiesView, presenter); (processingThread, startTime) = StartWork(); }
/// <summary> /// Attaches the view to the model. /// </summary> /// <param name="model">The linear after threshold model.</param> /// <param name="viewObject">The view - should be an XYPairsView.</param> /// <param name="parent">The explorer presenter for this tab.</param> public void Attach(object model, object viewObject, ExplorerPresenter parent) { function = model as LinearAfterThresholdFunction; if (function == null) { throw new ArgumentException(string.Format("Attempted to display a model of type {0} using the LinearAfterThresholdPresenter.", model.GetType().ToString())); } view = viewObject as XYPairsView; if (view == null) { throw new ArgumentException(string.Format("Attempted to use a view of type {0} from the LinearAfterThresholdPresenter. View should be an XYPairsView.", viewObject.GetType().ToString())); } presenter = parent; propertiesPresenter = new PropertyPresenter(); propertiesPresenter.Attach(function, view.VariablesGrid, presenter); DrawGraph(); view.VariablesGrid.CellsChanged += OnCellsChanged; }
/// <summary> /// Invoked whenever the user modifies the contents of the grid. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="args">Event arguments.</param> private void OnGridChanged(object sender, GridCellsChangedArgs args) { try { if (args.InvalidValue) { throw new Exception("The value you entered was not valid for its datatype."); } foreach (IGridCell cell in args.ChangedCells) { int index = GetModelIndex(cell.RowIndex); IModel removalType = Apsim.Child(model, grid.GetCell(0, index).Value.ToString()); if (removalType != null) { List <MemberInfo> members = PropertyPresenter.GetMembers(removalType); MemberInfo member = members[cell.RowIndex - index - 1]; IVariable property = null; if (member is PropertyInfo) { property = new VariableProperty(model, member as PropertyInfo); } else if (member is FieldInfo) { property = new VariableField(model, member as FieldInfo); } else { throw new Exception(string.Format("Unable to find property {0} in model {1}", grid.GetCell(0, cell.RowIndex).Value.ToString(), removalType.Name)); } object value = PropertyPresenter.FormatValueForProperty(property, cell.Value); ChangeProperty command = new ChangeProperty(removalType, property.Name, value); presenter.CommandHistory.Add(command); } } } catch (Exception err) { presenter.MainPresenter.ShowError(err); } }
/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The model to connect to.</param> /// <param name="v">The view to connect to.</param> /// <param name="parentPresenter">The parent explorer presenter.</param> public void Attach(object model, object v, ExplorerPresenter parentPresenter) { explorerPresenter = parentPresenter; view = v as IDualGridView; tableModel = model as IModelAsTable; if (tableModel.Tables.Count != 1) { throw new Exception("PropertyAndTablePresenter must have a single data table."); } table = tableModel.Tables[0]; view.Grid2.DataSource = table; view.Grid2.CellsChanged += OnCellValueChanged2; view.Grid2.NumericFormat = null; parentPresenter.CommandHistory.ModelChanged += OnModelChanged; propertyPresenter = new PropertyPresenter(); explorerPresenter.ApsimXFile.Links.Resolve(propertyPresenter); propertyPresenter.Attach(model, view.Grid1, parentPresenter); gridPresenter = new GridPresenter(); gridPresenter.Attach(model, view.Grid2, parentPresenter); }
/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The underlying model we are to use</param> /// <param name="view">The underlying view we are to attach to</param> /// <param name="explorerPresenter">Our parent explorerPresenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.model = model as Model; this.view = view as IProfileView; profileGrid.Attach(model, this.view.ProfileGrid, explorerPresenter); this.explorerPresenter = explorerPresenter; this.view.ShowView(false); // Setup the property presenter and view. Hide the view if there are no properties to show. this.propertyPresenter = new PropertyPresenter(); this.propertyPresenter.Attach(this.model, this.view.PropertyGrid, this.explorerPresenter); // Create a list of profile (array) properties. Create a table from them and // hand the table to the profile grid. this.FindAllProperties(this.model); // Populate the grid this.PopulateGrid(); // Populate the graph. this.graph = Utility.Graph.CreateGraphFromResource(model.GetType().Name + "Graph"); if (this.graph == null) { this.view.ShowGraph(false); } else { this.parentForGraph = this.model.Parent as IModel; if (this.parentForGraph != null) { this.parentForGraph.Children.Add(this.graph); this.graph.Parent = this.parentForGraph; this.view.ShowGraph(true); int padding = (this.view as ProfileView).MainWidget.Allocation.Width / 2 / 2; this.view.Graph.LeftRightPadding = padding; this.graphPresenter = new GraphPresenter(); for (int col = 0; col < this.propertiesInGrid.Count; col++) { VariableProperty property = this.propertiesInGrid[col]; string columnName = property.Description; // crop colours if (property.CropName != null && columnName.Contains("LL")) { Series cropLLSeries = new Series(); cropLLSeries.Name = columnName; cropLLSeries.Colour = ColourUtilities.ChooseColour(this.graph.Children.Count); cropLLSeries.Line = LineType.Solid; cropLLSeries.Marker = MarkerType.None; cropLLSeries.Type = SeriesType.Scatter; cropLLSeries.ShowInLegend = true; cropLLSeries.XAxis = Axis.AxisType.Top; cropLLSeries.YAxis = Axis.AxisType.Left; cropLLSeries.YFieldName = "[Soil].DepthMidPoints"; cropLLSeries.XFieldName = "[" + (property.Object as Model).Name + "]." + property.Name; cropLLSeries.Parent = this.graph; this.graph.Children.Add(cropLLSeries); } } this.graphPresenter.Attach(this.graph, this.view.Graph, this.explorerPresenter); } } // Trap the invoking of the ProfileGrid 'CellValueChanged' event so that // we can save the contents. this.view.ProfileGrid.CellsChanged += this.OnProfileGridCellValueChanged; // Trap the right click on column header so that we can potentially put // units on the context menu. this.view.ProfileGrid.GridColumnClicked += this.OnGridColumnClicked; // Trap the model changed event so that we can handle undo. this.explorerPresenter.CommandHistory.ModelChanged += this.OnModelChanged; this.view.ShowView(true); }
/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The underlying model we are to use</param> /// <param name="view">The underlying view we are to attach to</param> /// <param name="explorerPresenter">Our parent explorerPresenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.model = model as Model; this.view = view as IProfileView; this.explorerPresenter = explorerPresenter; // Setup the property presenter and view. Hide the view if there are no properties to show. this.propertyPresenter = new PropertyPresenter(); this.propertyPresenter.Attach(this.model, this.view.PropertyGrid, this.explorerPresenter); // Create a list of profile (array) properties. Create a table from them and // hand the table to the profile grid. this.FindAllProperties(this.model); // Populate the grid this.PopulateGrid(); // Populate the graph. this.graph = Utility.Graph.CreateGraphFromResource(model.GetType().Name + "Graph"); if (this.graph == null) { this.view.ShowGraph(false); } else { parentForGraph = this.model.Parent as IModel; if (this.parentForGraph != null) { this.parentForGraph.Children.Add(this.graph); this.graph.Parent = this.parentForGraph; this.view.ShowGraph(true); int padding = (this.view as ProfileView).MainWidget.Allocation.Width / 2 / 2; this.view.Graph.LeftRightPadding = padding; this.graphPresenter = new GraphPresenter(); this.graphPresenter.Attach(this.graph, this.view.Graph, this.explorerPresenter); } } // Trap the invoking of the ProfileGrid 'CellValueChanged' event so that // we can save the contents. this.view.ProfileGrid.CellsChanged += this.OnProfileGridCellValueChanged; // Trap the right click on column header so that we can potentially put // units on the context menu. this.view.ProfileGrid.ColumnHeaderClicked += this.OnColumnHeaderClicked; // Trap the model changed event so that we can handle undo. this.explorerPresenter.CommandHistory.ModelChanged += this.OnModelChanged; this.view.ProfileGrid.ResizeControls(); this.view.PropertyGrid.ResizeControls(); }
/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The underlying model we are to use</param> /// <param name="view">The underlying view we are to attach to</param> /// <param name="explorerPresenter">Our parent explorerPresenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.model = model as Model; this.view = view as IProfileView; profileGrid.Attach(model, this.view.ProfileGrid, explorerPresenter); this.explorerPresenter = explorerPresenter; this.view.ShowView(false); // Setup the property presenter and view. Hide the view if there are no properties to show. this.propertyPresenter = new PropertyPresenter(); this.propertyPresenter.Attach(this.model, this.view.PropertyGrid, this.explorerPresenter); propertyPresenter.ScalarsOnly = true; // Populate the grid this.PopulateGrid(); // Populate the graph. this.graph = Utility.Graph.CreateGraphFromResource("WaterGraph"); graph.Name = ""; if (this.graph == null) { this.view.ShowGraph(false); } else { // The graph's series contain many variables such as [Soil].LL. We now replace // these relative paths with absolute paths. foreach (Series series in graph.FindAllChildren <Series>()) { series.XFieldName = series.XFieldName?.Replace("[Soil]", this.model.Parent.FullPath); series.X2FieldName = series.X2FieldName?.Replace("[Soil]", this.model.Parent.FullPath); series.YFieldName = series.YFieldName?.Replace("[Soil]", this.model.Parent.FullPath); series.Y2FieldName = series.Y2FieldName?.Replace("[Soil]", this.model.Parent.FullPath); } this.parentForGraph = this.model.Parent as IModel; if (this.parentForGraph != null) { // Don't add the graph as a child of the soil. This causes problems // (see bug #4622), and adding the soil as a parent is sufficient. this.graph.Parent = this.parentForGraph; this.view.ShowGraph(true); int padding = (this.view as ProfileView).MainWidget.Allocation.Width / 2 / 2; this.view.Graph.LeftRightPadding = padding; this.graphPresenter = new GraphPresenter(); for (int i = 0; i < this.profileGrid.Properties.Length; i++) { string columnName = profileGrid.Properties[i].Name; if (columnName.Contains("\r\n")) { StringUtilities.SplitOffAfterDelimiter(ref columnName, "\r\n"); } // crop colours if (columnName.Contains("LL")) { if (profileGrid.Properties[i].Object is SoilCrop) { string soilCropName = (profileGrid.Properties[i].Object as SoilCrop).Name; string cropName = soilCropName.Replace("Soil", ""); columnName = cropName + " " + columnName; } Series cropLLSeries = new Series(); cropLLSeries.Name = columnName; cropLLSeries.Colour = ColourUtilities.ChooseColour(this.graph.Children.Count); cropLLSeries.Line = LineType.Solid; cropLLSeries.Marker = MarkerType.None; cropLLSeries.Type = SeriesType.Scatter; cropLLSeries.ShowInLegend = true; cropLLSeries.XAxis = Axis.AxisType.Top; cropLLSeries.YAxis = Axis.AxisType.Left; cropLLSeries.YFieldName = (parentForGraph is Soil ? parentForGraph.FullPath : "[Soil]") + ".Physical.DepthMidPoints"; cropLLSeries.XFieldName = ((profileGrid.Properties[i].Object as IModel)).FullPath + "." + profileGrid.Properties[i].Name; //cropLLSeries.XFieldName = ((property.Object as Model)).FullPath + "." + property.Name; cropLLSeries.Parent = this.graph; this.graph.Children.Add(cropLLSeries); } } this.graph.LegendPosition = Graph.LegendPositionType.RightTop; explorerPresenter.ApsimXFile.Links.Resolve(graphPresenter); this.graphPresenter.Attach(this.graph, this.view.Graph, this.explorerPresenter); graphPresenter.LegendInsideGraph = false; } } // Trap the model changed event so that we can handle undo. this.explorerPresenter.CommandHistory.ModelChanged += this.OnModelChanged; this.view.ShowView(true); }
/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The underlying model we are to use</param> /// <param name="view">The underlying view we are to attach to</param> /// <param name="explorerPresenter">Our parent explorerPresenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.model = model as Model; this.view = view as IProfileView; profileGrid.Attach(model, this.view.ProfileGrid, explorerPresenter); this.explorerPresenter = explorerPresenter; this.view.ShowView(false); // Setup the property presenter and view. Hide the view if there are no properties to show. this.propertyPresenter = new PropertyPresenter(); this.propertyPresenter.Attach(this.model, this.view.PropertyGrid, this.explorerPresenter); // Create a list of profile (array) properties. Create a table from them and // hand the table to the profile grid. this.FindAllProperties(this.model); // Populate the grid this.PopulateGrid(); // Populate the graph. this.graph = Utility.Graph.CreateGraphFromResource(model.GetType().Name + "Graph"); if (this.graph == null) { this.view.ShowGraph(false); } else { // The graph's series contain many variables such as [Soil].LL. We now replace // these relative paths with absolute paths. foreach (Series series in Apsim.Children(graph, typeof(Series))) { series.XFieldName = series.XFieldName?.Replace("[Soil]", Apsim.FullPath(this.model.Parent)); series.X2FieldName = series.X2FieldName?.Replace("[Soil]", Apsim.FullPath(this.model.Parent)); series.YFieldName = series.YFieldName?.Replace("[Soil]", Apsim.FullPath(this.model.Parent)); series.Y2FieldName = series.Y2FieldName?.Replace("[Soil]", Apsim.FullPath(this.model.Parent)); } this.parentForGraph = this.model.Parent as IModel; if (this.parentForGraph != null) { this.parentForGraph.Children.Add(this.graph); this.graph.Parent = this.parentForGraph; this.view.ShowGraph(true); int padding = (this.view as ProfileView).MainWidget.Allocation.Width / 2 / 2; this.view.Graph.LeftRightPadding = padding; this.graphPresenter = new GraphPresenter(); for (int col = 0; col < this.propertiesInGrid.Count; col++) { string columnName = propertiesInGrid[col].ColumnName; if (columnName.Contains("\r\n")) { StringUtilities.SplitOffAfterDelimiter(ref columnName, "\r\n"); } // crop colours if (columnName.Contains("LL")) { Series cropLLSeries = new Series(); cropLLSeries.Name = columnName; cropLLSeries.Colour = ColourUtilities.ChooseColour(this.graph.Children.Count); cropLLSeries.Line = LineType.Solid; cropLLSeries.Marker = MarkerType.None; cropLLSeries.Type = SeriesType.Scatter; cropLLSeries.ShowInLegend = true; cropLLSeries.XAxis = Axis.AxisType.Top; cropLLSeries.YAxis = Axis.AxisType.Left; cropLLSeries.YFieldName = (parentForGraph is Soil ? Apsim.FullPath(parentForGraph) : "[Soil]") + ".DepthMidPoints"; cropLLSeries.XFieldName = Apsim.FullPath((propertiesInGrid[col].ObjectWithProperty as Model)) + "." + propertiesInGrid[col].PropertyName; //cropLLSeries.XFieldName = Apsim.FullPath(property.Object as Model) + "." + property.Name; cropLLSeries.Parent = this.graph; this.graph.Children.Add(cropLLSeries); } } explorerPresenter.ApsimXFile.Links.Resolve(graphPresenter); this.graphPresenter.Attach(this.graph, this.view.Graph, this.explorerPresenter); } } // Trap the invoking of the ProfileGrid 'CellValueChanged' event so that // we can save the contents. this.view.ProfileGrid.CellsHaveChanged += this.OnProfileGridCellValueChanged; // Trap the right click on column header so that we can potentially put // units on the context menu. this.view.ProfileGrid.ColumnMenuClicked += this.OnColumnMenuItemClicked; // Trap the model changed event so that we can handle undo. this.explorerPresenter.CommandHistory.ModelChanged += this.OnModelChanged; this.view.ShowView(true); }