private protected virtual void UpdateInterfaceType(Type nodeType) { if (InterfaceType == Type.Missing) { string[] Split = CollectionName.Split('.'); Type BaseType = nodeType; for (int i = 0; i < Split.Length; i++) { string PropertyName = Split[i]; Type ChildNodeType; if (i + 1 < Split.Length) { bool IsValidProperty = NodeTreeHelperChild.IsChildNodeProperty(BaseType, PropertyName, out ChildNodeType) || NodeTreeHelperOptional.IsOptionalChildNodeProperty(BaseType, PropertyName, out ChildNodeType); Debug.Assert(IsValidProperty); BaseType = ChildNodeType; } else { Type ChildInterfaceType; bool IsValidProperty = NodeTreeHelperBlockList.IsBlockListProperty(BaseType, PropertyName, /*out ChildInterfaceType,*/ out /*ChildNodeType*/ ChildInterfaceType) || NodeTreeHelperList.IsNodeListProperty(BaseType, PropertyName, out ChildInterfaceType); Debug.Assert(IsValidProperty); BaseType = ChildInterfaceType; } } InterfaceType = BaseType; } }
/// <summary> /// Returns the inner for the collection associated to this frame, for a given state. /// </summary> /// <param name="state">The state, modified if <see cref="IFrameInsertFrame.CollectionName"/> points to a different state.</param> /// <param name="inner">The inner associated to the collection in <paramref name="state"/>.</param> public virtual void CollectionNameToInner(ref IFocusNodeState state, ref IFocusCollectionInner inner) { Debug.Assert(inner == null); string[] Split = CollectionName.Split('.'); for (int i = 0; i < Split.Length; i++) { string PropertyName = Split[i]; if (i + 1 < Split.Length) { Debug.Assert(state.InnerTable.ContainsKey(PropertyName)); bool IsHandled = false; switch (state.InnerTable[PropertyName]) { case IFocusPlaceholderInner <IFocusBrowsingPlaceholderNodeIndex> AsPlaceholderInner: state = AsPlaceholderInner.ChildState; IsHandled = true; break; case IFocusOptionalInner <IFocusBrowsingOptionalNodeIndex> AsOptionalInner: Debug.Assert(AsOptionalInner.IsAssigned); state = AsOptionalInner.ChildState; IsHandled = true; break; } Debug.Assert(IsHandled); } else { Debug.Assert(state.InnerTable.ContainsKey(PropertyName)); inner = state.InnerTable[PropertyName] as IFocusCollectionInner; } } Debug.Assert(inner != null); Debug.Assert(state.InnerTable.ContainsKey(inner.PropertyName)); Debug.Assert(state.InnerTable[inner.PropertyName] == inner); }
public MvcHtmlString AddButton() { return(MvcHtmlString.Create(string.Format("<button class='addButton' type='button' title='Add' data-bind='click: $root.add{0}'>Add</button>", CollectionName.Split('.').LastOrDefault()))); }
public MvcHtmlString RemoveButton() { return(MvcHtmlString.Create(string.Format("<button class='removeButton' type='button' title='Remove' data-bind='click: $root.remove{0}'>Remove</button>", CollectionName.Split('.').LastOrDefault()))); }