/// <summary> /// Creates a tile. Tile elements can contain only examples. /// </summary> /// <param name="element"></param> /// <param name="categoryNamespace"></param> /// <returns></returns> private NWidget CreateTile(NXmlElement element, string categoryNamespace) { string tileTitle = element.GetAttributeValue("name"); string iconName = element.GetAttributeValue("icon"); // Get the icon for the tile NImage icon = null; if (iconName != null) { if (NApplication.IOService.DirectorySeparatorChar != '\\') { iconName = iconName.Replace('\\', NApplication.IOService.DirectorySeparatorChar); } string imageFolder = NPath.GetFullDirectoryName(iconName); if (String.IsNullOrEmpty(imageFolder)) { // The icon is in the folder for the current category imageFolder = categoryNamespace; } else { // The icon is in a folder of another category imageFolder = NPath.Normalize(NPath.Combine(categoryNamespace, imageFolder)); if (imageFolder[imageFolder.Length - 1] == NApplication.IOService.DirectorySeparatorChar) { imageFolder = imageFolder.Remove(imageFolder.Length - 1); } // Update the icon name iconName = NPath.GetFileName(iconName); } iconName = "RIMG_ExampleIcons_" + imageFolder + "_" + iconName.Replace('.', '_'); icon = new NImage(new NEmbeddedResourceRef(NResources.Instance, iconName)); } // Create and configure the tile NExampleTile tile = new NExampleTile(icon, tileTitle); tile.HorizontalPlacement = ENHorizontalPlacement.Left; tile.Status = element.GetAttributeValue("status"); tile.Tag = new NItemInfo(element); // Add the examples of the current tile to the examples map INIterator <NXmlNode> iter = element.GetChildNodesIterator(); while (iter.MoveNext()) { NXmlElement exampleElement = iter.Current as NXmlElement; if (exampleElement == null) { continue; } string examplePath = GetExamplePath(exampleElement); if (icon != null) { icon = new NImage(icon.ImageSource); } NExampleTile example = new NExampleTile(icon, examplePath); example.Status = exampleElement.GetAttributeValue("status"); example.Tag = new NItemInfo(exampleElement); if (m_ExamplesMap.Contains(examplePath) == false) { m_ExamplesMap.Add(examplePath, example); } } return(tile); }