[UsedImplicitly] // called from template functions, public static LinqBindingNode Get(Application application, UIElement rootElement, UIElement element, UIElement innerContext, int createdId, int enabledId, int updatedId, int lateId) { LinqBindingNode node = new LinqBindingNode(); // todo -- pool node.root = rootElement; node.element = element; node.innerContext = innerContext; element.bindingNode = node; // todo -- profile this against skip tree UIElement ptr = element.parent; while (ptr != null) { if (ptr.bindingNode != null) { node.parent = ptr.bindingNode; break; } ptr = ptr.parent; } node.SetBindings(application, rootElement, createdId, enabledId, updatedId, lateId); return(node); }
public static LinqBindingNode GetSlotNode(Application application, UIElement rootElement, UIElement element, UIElement innerContext, int createdId, int enabledId, int updatedId, int lateId, string slotName, TemplateScope templateScope, int slotContextSize) { LinqBindingNode node = new LinqBindingNode(); // todo -- pool node.root = rootElement; node.element = element; node.innerContext = innerContext; element.bindingNode = node; // todo -- profile this against skip tree UIElement ptr = element.parent; while (ptr != null) { if (ptr.bindingNode != null) { node.parent = ptr.bindingNode; break; } ptr = ptr.parent; } node.InitializeContextArray(slotName, templateScope, slotContextSize); node.SetBindings(application, rootElement, createdId, enabledId, updatedId, lateId); return(node); }
public static LinqBindingNode GetSlotModifyNode(Application application, UIElement rootElement, UIElement element, UIElement innerContext, int createdId, int enabledId, int updatedId, int lateId) { LinqBindingNode node = s_NodePool.Get(); node.Initialize(rootElement, element, innerContext); // todo -- profile this against skip tree UIElement ptr = element.parent; while (ptr != null) { if (ptr.bindingNode != null) { node.parent = ptr.bindingNode; break; } ptr = ptr.parent; } node.referencedContexts = new UIElement[1]; node.referencedContexts[0] = innerContext; node.SetBindings(application, rootElement, createdId, enabledId, updatedId, lateId); return(node); }
private void RunBindings(LightList <UIElement> elementsToUpdate) { for (int i = elementsToUpdate.size - 1; i >= 0; i--) { LinqBindingNode bindingNode = elementsToUpdate[i].bindingNode; bindingNode?.updateBindings?.Invoke(bindingNode.root, bindingNode.element); } }
private void RunWriteBindingsAndReleaseList(LightList <UIElement> elementsToUpdate) { for (int i = 0; i < elementsToUpdate.size; i++) { LinqBindingNode bindingNode = elementsToUpdate[i].bindingNode; bindingNode?.lateBindings?.Invoke(bindingNode.root, bindingNode.element); } elementsToUpdate.Release(); }
private void Initialize(UIElement root, UIElement element, UIElement innerContext) { this.root = root; this.element = element; this.innerContext = innerContext; element.bindingNode = this; this.lastBeforeUpdateFrame = default; this.lastAfterUpdateFrame = default; this.createdBinding = default; this.enabledBinding = default; this.updateBindings = default; this.lateBindings = default; this.localVariable = default; this.parent = default; this.referencedContexts = default; }
public ContextVariable GetContextVariable(int id) { ContextVariable ptr = localVariable; while (ptr != null) { if (ptr.id == id) { return(ptr.reference ?? ptr); } ptr = ptr.next; } // if didnt find a local variable, start a search upwards // if found, reference locally. should only hit this once if (parent == null) { UIElement elemPtr = element.parent; while (elemPtr != null) { if (elemPtr.bindingNode != null) { parent = elemPtr.bindingNode; break; } elemPtr = elemPtr.parent; } } ContextVariable value = parent?.GetContextVariable(id); // it is technically an error if we can't find the context variable, something went wrong with compilation Debug.Assert(value != null, nameof(value) + " != null"); value = value.CreateReference(); CreateLocalContextVariable(value); return(value); }
public static void Release(LinqBindingNode node) { s_NodePool.Release(node); node.localVariable?.Release(); }