Example #1
0
        /// <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;

            allowableChildModels = Apsim.GetAllowableChildModels(this.model);

            this.view.List.Values = allowableChildModels.Select(m => m.Name).ToArray();
            this.view.AddButton("Add", null, this.OnAddButtonClicked);

            // Trap events from the view.
            this.view.List.DoubleClicked += this.OnAddButtonClicked;
        }
Example #2
0
        /// <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;
        }
Example #3
0
        /// <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.explorerPresenter = explorerPresenter;

            tree           = (view as ViewBase).GetControl <TreeView>("treeview");
            addModelButton = (view as ViewBase).GetControl <ButtonView>("button");
            filterEdit     = (view as ViewBase).GetControl <EditView>("filterEdit");

            allowableChildModels = Apsim.GetAllowableChildModels(this.model);

            tree.ReadOnly = true;

            PopulateTree(allowableChildModels);

            // Trap events from the view.
            addModelButton.Clicked += OnAddButtonClicked;
            tree.DragStarted       += OnDragStart;
            tree.DoubleClicked     += OnAddButtonClicked;
            filterEdit.Changed     += OnFilterChanged;
        }