public bool IsValid(Type nodeType, FrameTemplateReadOnlyDictionary nodeTemplateTable, ref int commentFrameCount) { return(false); }
/// <summary> /// Checks that a frame is correctly constructed. /// </summary> /// <param name="nodeType">Type of the node this frame can describe.</param> /// <param name="nodeTemplateTable">Table of templates with all frames.</param> /// <param name="commentFrameCount">Number of comment frames found so far.</param> public override bool IsValid(Type nodeType, FrameTemplateReadOnlyDictionary nodeTemplateTable, ref int commentFrameCount) { bool IsValid = true; IsValid &= base.IsValid(nodeType, nodeTemplateTable, ref commentFrameCount); IsValid &= Items.Count > 0; IsValid &= IsParentRoot; List <string> NameList = new List <string>(); int SelectionCommentFrameCount = -1; List <Dictionary <string, FocusFrameSelectorList> > SelectorTableList = new List <Dictionary <string, FocusFrameSelectorList> >(); Dictionary <string, FocusFrameSelectorList> SelectorTable; foreach (IFocusSelectableFrame Item in Items) { int SelectableCommentFrameCount = 0; IsValid &= Item.IsValid(nodeType, nodeTemplateTable, ref SelectableCommentFrameCount); IsValid &= !NameList.Contains(Item.Name); // Use the count for the first frame as base count. if (SelectionCommentFrameCount < 0) { SelectionCommentFrameCount = SelectableCommentFrameCount; } // All selectable frames must have the same count. IsValid &= SelectionCommentFrameCount == SelectableCommentFrameCount; NameList.Add(Item.Name); SelectorTable = new Dictionary <string, FocusFrameSelectorList>(); Item.CollectSelectors(SelectorTable); SelectorTableList.Add(SelectorTable); } // Use the common count of all selectable frames as the count of the selection frame. commentFrameCount += SelectionCommentFrameCount; // Check that all selectable have the same nested selectors. See FrameSelectorForProperty(). SelectorTable = new Dictionary <string, FocusFrameSelectorList>(); CollectSelectors(SelectorTable); Debug.Assert(SelectorTable.Count == 0); List <string> PropertyNameList = new List <string>(); foreach (Dictionary <string, FocusFrameSelectorList> Table in SelectorTableList) { foreach (KeyValuePair <string, FocusFrameSelectorList> Entry in Table) { if (!PropertyNameList.Contains(Entry.Key)) { PropertyNameList.Add(Entry.Key); } } } foreach (string PropertyName in PropertyNameList) { List <FocusFrameSelectorList> TableWithPropertyList = new List <FocusFrameSelectorList>(); foreach (Dictionary <string, FocusFrameSelectorList> Table in SelectorTableList) { if (Table.ContainsKey(PropertyName)) { TableWithPropertyList.Add(Table[PropertyName]); } } Debug.Assert(TableWithPropertyList.Count > 0); FocusFrameSelectorList FirstItem = TableWithPropertyList[0]; CompareEqual Comparer = CompareEqual.New(canReturnFalse: true); for (int i = 1; i < TableWithPropertyList.Count; i++) { IsValid &= FirstItem.IsEqual(Comparer, TableWithPropertyList[i]); } } if (!IsValid) { } Debug.Assert(IsValid); return(IsValid); }
/// <summary> /// Checks that a frame is correctly constructed. /// </summary> /// <param name="nodeType">Type of the node this frame can describe.</param> /// <param name="nodeTemplateTable">Table of templates with all frames.</param> /// <param name="commentFrameCount">Number of comment frames found so far.</param> public abstract override bool IsValid(Type nodeType, FrameTemplateReadOnlyDictionary nodeTemplateTable, ref int commentFrameCount);
/// <summary> /// Creates a IxxxTemplateSet object. /// </summary> private protected override IFrameTemplateSet CreateDefaultTemplateSet(FrameTemplateReadOnlyDictionary nodeTemplateTable, FrameTemplateReadOnlyDictionary blockTemplateTable) { ControllerTools.AssertNoOverride(this, Type.FromTypeof <FocusTemplateSet>()); return(new FocusTemplateSet((FocusTemplateReadOnlyDictionary)nodeTemplateTable, (FocusTemplateReadOnlyDictionary)blockTemplateTable)); }