public virtual void Traverse(Element e) { // Execute delegate if defined if (null != e.ElementTraversingDelegate) { e.ElementTraversingDelegate(e); } // Dive deeper 01 RootElement re = e as RootElement; if (null != re) { foreach (Section s in re.Sections) { // Set delegate s.ElementTraversingDelegate += e.ElementTraversingDelegate; // Dive in (execute delegate and dive) s.Traverse(s); } } // Dive deeper 02 Section section = this as Section; if (null != section) { foreach (Element element in section.Elements) { // Set delegate element.ElementTraversingDelegate += section.ElementTraversingDelegate; // Dive in (execute delegate and dive) element.Traverse(element); } } return; }
/// <summary> /// Allows caller to programatically activate the search bar and start the search process /// </summary> public void StartSearch () { if (originalSections != null) return; searchBar.BecomeFirstResponder (); originalSections = Root.Sections.ToArray (); originalElements = new Element [originalSections.Length][]; for (int i = 0; i < originalSections.Length; i++) originalElements [i] = originalSections [i].Elements.ToArray (); }
void AddMapping (string id, Element element) { if (jsonParent != null){ jsonParent.AddMapping (id, element); return; } if (map == null) map = new Dictionary<string, Element> (); map.Add (id, element); }
static void re3_ElementTraversingDelegate(Element e) { Debug.WriteLine(e.ToString()); return; }