Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
 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;
         }
     }
 }
Ejemplo n.º 3
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;
            ExampleFinder vbExampleFinder;

            if (examplesCS.Count == 0)
            {
                current         = examplesVB;
                csExampleFinder = null;
                vbExampleFinder = new ExampleFinderVB();
            }
            else if (examplesVB.Count == 0)
            {
                current         = examplesCS;
                csExampleFinder = new ExampleFinderCSharp();
                vbExampleFinder = null;
            }
            else
            {
                current         = examplesCS;
                csExampleFinder = new ExampleFinderCSharp();
                vbExampleFinder = new ExampleFinderVB();
            }

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

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

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

                List <CodeExample> mergedExamples = new List <CodeExample>();

                if (foundExamplesCS.Count != 0 && foundExamplesVB.Count == 0)
                {
                    mergedExamples = foundExamplesCS;
                }
                else if (foundExamplesCS.Count == 0 && foundExamplesVB.Count != 0)
                {
                    mergedExamples = foundExamplesVB;
                }
                else if ((foundExamplesCS.Count == foundExamplesVB.Count))
                {
                    mergedExamples = MergeExamples(foundExamplesCS, foundExamplesVB);
                }

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

                CodeExampleGroup group = new CodeExampleGroup()
                {
                    Name     = mergedExamples[0].HumanReadableGroupName,
                    Examples = mergedExamples
                };
                result.Add(group);
            }
            return(result);
        }
Ejemplo n.º 4
0
 internal void Merge(CodeExampleGroup n)
 {
     this.Examples.AddRange(n.Examples);
 }