void treeList_VirtualTreeGetCellValue(object sender, VirtualTreeGetCellValueInfo args)
        {
            CodeExampleGroup group = args.Node as CodeExampleGroup;

            if (group != null)
            {
                args.CellData = group.Name;
            }

            CodeExample example = args.Node as CodeExample;

            if (example != null)
            {
                args.CellData = example.RegionName;
            }
        }
Пример #2
0
        public static List <CodeExampleGroup> FindExamples(string examplePath, Dictionary <string, FileInfo> examplesCS, Dictionary <string, FileInfo> examplesVB)
        {
            List <CodeExampleGroup> result = new List <CodeExampleGroup>();

            Dictionary <string, FileInfo> current = null;
            ExampleFinder csExampleFinder         = new ExampleFinderCSharp();
            ExampleFinder vbExampleFinder         = new ExampleFinderVB();

            current = (examplesCS.Count != 0) ? examplesCS : examplesVB;

            foreach (KeyValuePair <string, FileInfo> sourceCodeItem in current)
            {
                string key = sourceCodeItem.Key;

                List <CodeExample> foundExamplesCS = new List <CodeExample>();
                if (examplesCS.Count != 0)
                {
                    foundExamplesCS = csExampleFinder.Process(examplesCS[key]);
                }

                List <CodeExample> foundExamplesVB = new List <CodeExample>();
                if (examplesVB.Count != 0)
                {
                    foundExamplesVB = vbExampleFinder.Process(examplesVB[key]);
                }

                CodeExampleCollection mergedExamplesCollection = new CodeExampleCollection();

                mergedExamplesCollection.Merge(foundExamplesCS);
                mergedExamplesCollection.Merge(foundExamplesVB);

                if (mergedExamplesCollection.Count == 0)
                {
                    continue;
                }

                CodeExampleGroup group = new CodeExampleGroup()
                {
                    Name     = mergedExamplesCollection[0].HumanReadableGroupName,
                    Examples = mergedExamplesCollection
                };
                result.Add(group);
            }
            return(result);
        }
 void treeList_VirtualTreeGetChildNodes(object sender, VirtualTreeGetChildNodesInfo args)
 {
     if (treeListRootNodeLoading)
     {
         args.Children           = examples;
         treeListRootNodeLoading = false;
     }
     else
     {
         if (args.Node == null)
         {
             return;
         }
         CodeExampleGroup group = args.Node as CodeExampleGroup;
         if (group != null)
         {
             args.Children = group.Examples;
         }
     }
 }