Пример #1
0
        private void AddFileNode(CodeSampleFile file, TreeNode parent)
        {
            var tn  = new TreeNode(file.Name);
            var inf = app.EditorInfo(file.File);

            if (!treeView.ImageList.Images.ContainsKey(inf.Key))
            {
                treeView.ImageList.Images.Add(inf.Key, inf.Instance.DocumentIcon);
            }

            tn.ImageKey = tn.SelectedImageKey = inf.Key;
            tn.Tag      = file;

            if (parent != null)
            {
                parent.Nodes.Add(tn);
            }
            else
            {
                treeView.Nodes.Add(tn);
            }
        }
Пример #2
0
        private void ReadElements(XmlReader reader, CodeSampleFolder parent)
        {
            while (reader.Read())
            {
                if (reader.IsStartElement("folder"))
                {
                    var folder = new CodeSampleFolder(reader.GetAttribute("name"), reader.GetAttribute("description"));
                    parent.AddNode(folder);
                    var sr = reader.ReadSubtree();
                    sr.Read();
                    ReadElements(sr, folder);
                }
                else if (reader.IsStartElement("sample"))
                {
                    var file = new FileInfo(Path.Combine(baseDir, reader.GetAttribute("file")));

                    if (file.Exists)
                    {
                        var sample = new CodeSampleFile(reader.GetAttribute("name"), file, reader.GetAttribute("description"));
                        parent.AddNode(sample);
                    }
                }
            }
        }
Пример #3
0
        private void ReadElements(XmlReader reader, CodeSampleFolder parent)
        {
            while (reader.Read())
            {
                if (reader.IsStartElement("folder"))
                {
                    var folder = new CodeSampleFolder(reader.GetAttribute("name"), reader.GetAttribute("description"));
                    parent.AddNode(folder);
                    var sr = reader.ReadSubtree();
                    sr.Read();
                    ReadElements(sr, folder);
                }
                else if (reader.IsStartElement("sample"))
                {
                    var file = new FileInfo(Path.Combine(baseDir, reader.GetAttribute("file")));

                    if (file.Exists)
                    {
                        var sample = new CodeSampleFile(reader.GetAttribute("name"), file, reader.GetAttribute("description"));
                        parent.AddNode(sample);
                    }
                }
            }
        }