public void LoadFromStream(Stream stream) { // Load an xml document from the stream NXmlDocument xmlDocument = NXmlDocument.LoadFromStream(stream); // Process it if (xmlDocument == null || xmlDocument.ChildrenCount != 1) { return; } m_ExamplesMap = new NStringMap <NWidget>(false); // Get the root element (i.e. the <document> element) NXmlElement rootElement = (NXmlElement)xmlDocument.GetChildAt(0); // Process the head NXmlElement titleElement = (NXmlElement)rootElement.GetFirstChild("title"); m_HeaderLabel.Text = ((NXmlTextNode)titleElement.GetChildAt(0)).Text; NXmlElement statusColorsElement = (NXmlElement)rootElement.GetFirstChild("statusColors"); ParseStatusColors(statusColorsElement); // Process the categories NXmlElement categoriesElement = (NXmlElement)rootElement.GetFirstChild("categories"); ((NWelcomePanel)m_PagePanel[0]).Initialize(categoriesElement); for (int i = 0, count = categoriesElement.ChildrenCount; i < count; i++) { NXmlElement child = categoriesElement.GetChildAt(i) as NXmlElement; if (child == null) { continue; } if (child.Name != "category") { throw new Exception("The body element can contain only category elements"); } // Create a widget and add it to the categories panel NWidget category = CreateCategory(child); m_PagePanel.Add(category); } // Init the search box m_SearchBox.InitAutoComplete(m_ExamplesMap, new NExampleFactory()); m_SearchBox.ListBoxItemSelected += OnSearchBoxListBoxItemSelected; }