private void OnTreeViewSelectedPathChanged(NValueChangeEventArgs arg)
        {
            m_DataTable.RemoveAllRows();
            m_GridView.Grid.Update();

            NTreeView     treeView     = (NTreeView)arg.CurrentTargetNode;
            NTreeViewItem selectedItem = treeView.SelectedItem;

            if (selectedItem == null)
            {
                return;
            }

            // Get the resource container and the images for the selected item
            NEmbeddedResourceContainer resourceContainer = GetResourceContainer(selectedItem);
            NList <string>             images            = GetImageNames(selectedItem);

            // Populate the stack with the images in the selected resources folder
            string containerType = resourceContainer.GetType().FullName;

            for (int i = 0; i < images.Count; i++)
            {
                string resourceName = images[i];

                string imageName = resourceName.Replace("RIMG", "Image");
                NImage image     = NImage.FromResource(resourceContainer.GetResource(resourceName));
                string imageSize = image.Width.ToString(
                    CultureInfo.InvariantCulture) +
                                   " x " +
                                   image.Height.ToString(CultureInfo.InvariantCulture);
                string code = containerType + "." + imageName;

                m_DataTable.AddRow(image, imageName, imageSize, code);
            }
        }
        private NTreeViewItem CreateRootItem(NEmbeddedResourceContainer resourceContainer)
        {
            string nspace = resourceContainer.GetType().Namespace;
            string name   = nspace.Substring("Nevron.Nov.".Length);

            NTreeViewItem rootItem = new NTreeViewItem(name);

            m_ResourcesMap.Set(rootItem, resourceContainer);
            rootItem.Expanded = true;

            string[] names = resourceContainer.GetResourceNames();
            for (int i = 0; i < names.Length; i++)
            {
                string[] tokens = names[i].Split('_');
                if (tokens[0] != "RIMG")
                {
                    continue;
                }

                // Navigate to the path of the current image resource in the tree view
                NTreeViewItem item = rootItem;
                for (int j = 1; j < tokens.Length - 2; j++)
                {
                    item = GetOrCreateItem(item.Items, tokens[j]);
                }

                // Add the image resource to the path
                NList <string> images = GetImageNames(item);
                if (images == null)
                {
                    images   = new NList <string>();
                    item.Tag = images;
                }

                images.Add(names[i]);
            }

            return(rootItem);
        }