/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { //set up the variables for GetData MainWindow mw = null; List <UIElement_Goo> elementsToAdd = new List <UIElement_Goo>(); Dictionary <string, UIElement_Goo> resultDict = new Dictionary <string, UIElement_Goo>(); //Get data from component if (!DA.GetData <MainWindow>("Window", ref mw)) { return; } if (!DA.GetDataList <UIElement_Goo>("Elements", elementsToAdd)) { return; } //clear out any old elements mw.clearElements(); if (DoVLChecking) { //check for any value listener connected to the same window var ActiveObjects = OnPingDocument().ActiveObjects(); var AllSources = HUI_Util.SourcesRecursive(Params.Input[1], ActiveObjects); var ValueListenerSources = AllSources.OfType <ValueListener_Component>(); if (ValueListenerSources.Count() != 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, VALUE_LISTENER_WARNING); } } //for all the elements, remove its parent, add it to the window, and add it to our tracking dictionary foreach (UIElement_Goo u in elementsToAdd) { if (u == null) { continue; } HUI_Util.removeParent(u.element); mw.AddElement(u.element); HUI_Util.AddToDict(u, resultDict); } //Pass out the added elements and their names. This is no longer so necessary now that listeners attach to elements directly. DA.SetDataList("Added Elements", resultDict); DA.SetDataList("Element Names", resultDict.Keys); }