/// <summary>Attach the specified Model and View.</summary> /// <param name="model">The axis model</param> /// <param name="view">The axis view</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.model = model as IModel; this.view = view as IListButtonView; this.explorerPresenter = explorerPresenter; allowableChildFunctions = Apsim.GetAllowableChildFunctions(this.model); this.view.List.Values = allowableChildFunctions.Select(m => m.Name).ToArray(); this.view.AddButton("Add", null, this.OnAddButtonClicked); // Trap events from the view. this.view.List.DoubleClicked += this.OnAddButtonClicked; }
/// <summary>Attach the specified Model and View.</summary> /// <param name="model">The axis model</param> /// <param name="view">The axis view</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.model = model as IModel; this.view = view as IListButtonView; this.explorerPresenter = explorerPresenter; this.allowableChildModels = Apsim.GetAllowableChildModels(this.model); List <Type> allowableChildFunctions = Apsim.GetAllowableChildFunctions(this.model); this.allowableChildModels.RemoveAll(a => allowableChildFunctions.Any(b => a == b)); this.view.List.IsModelList = true; this.view.List.Values = this.allowableChildModels.Select(m => m.Name).ToArray(); this.view.AddButton("Add", null, this.OnAddButtonClicked); // Trap events from the view. this.view.List.DoubleClicked += this.OnAddButtonClicked; this.view.List.DragStarted += this.OnDragStart; }