예제 #1
0
        /// <summary>
        /// Loads the tree of document samples
        /// </summary>
        void LoadSamples()
        {
            m_HTMLRendererSamplesRoot = m_ExamplesTreeView.AddNode("HTML Renderer");
            m_HTMLRendererSamplesRoot.NormalTextColor = GroupColor;
            m_HTMLRendererSamplesRoot.HoverTextColor  = HoverColor;
            m_HTMLRendererSamplesRoot.IsSelectable    = false;

            Alt.GUI.Temporary.Gwen.Control.TreeNode testSamplesRoot = m_ExamplesTreeView.AddNode("Test Samples");
            testSamplesRoot.NormalTextColor = GroupColor;
            testSamplesRoot.HoverTextColor  = HoverColor;
            testSamplesRoot.IsSelectable    = false;

            Alt.GUI.Temporary.Gwen.Control.TreeNode perfTestSamplesRoot = m_ExamplesTreeView.AddNode("Performance Samples");
            perfTestSamplesRoot.NormalTextColor = GroupColor;
            perfTestSamplesRoot.HoverTextColor  = HoverColor;
            perfTestSamplesRoot.IsSelectable    = false;

            //var names = Assembly.GetExecutingAssembly().GetManifestResourceNames();
            List <string> fnames = new List <string>();
            var           fn     = Alt.IO.VirtualDirectory.GetFiles("AltData/HtmlRenderer/Samples");

            if (fn != null &&
                fn.Length > 0)
            {
                fnames.AddRange(fn);
            }
            fn = Alt.IO.VirtualDirectory.GetFiles("AltData/HtmlRenderer/TestSamples");
            if (fn != null &&
                fn.Length > 0)
            {
                fnames.AddRange(fn);
            }

            var names = fnames.ToArray();

            Array.Sort(names);
            foreach (string name in names)
            {
                int    extPos    = name.LastIndexOf('.');
                int    namePos   = extPos > 0 && name.Length > 1 ? name.LastIndexOf('.', extPos - 1) : 0;
                string ext       = name.Substring(extPos >= 0 ? extPos : 0);
                string shortName = namePos > 0 && name.Length > 2 ? name.Substring(namePos + 1, name.Length - namePos - ext.Length - 1) : name;

                if (".htm".IndexOf(ext) >= 0)
                {
                    var resourceStream = //Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
                                         Alt.IO.VirtualFile.OpenRead(name);
                    if (resourceStream != null)
                    {
                        using (System.IO.StreamReader sreader = new System.IO.StreamReader(resourceStream
#if !SILVERLIGHT
                                                                                           , Encoding.Default
#endif
                                                                                           ))
                        {
                            m_Samples[name] = sreader.ReadToEnd();
                        }

                        Alt.GUI.Temporary.Gwen.Control.TreeNode node;
                        if (name.Contains("TestSamples"))//."))
                        {
                            node = testSamplesRoot.AddNode(shortName);
                        }
                        else if (name.Contains("PerfSamples"))
                        {
                            node = perfTestSamplesRoot.AddNode(shortName);
                        }
                        else
                        {
                            node = m_HTMLRendererSamplesRoot.AddNode(shortName);
                        }
                        node.Tag = name;

                        node.NormalTextColor   = NormalColor;
                        node.SelectedTextColor = SelectedColor;
                        node.HoverTextColor    = HoverColor;
                    }
                }
            }


            if (perfTestSamplesRoot.Children.Count < 1)
            {
                m_ExamplesTreeView.RemoveChild(perfTestSamplesRoot, true);
            }


            m_ExamplesTreeView.ExpandAll();
            //root.ExpandAll();
            //testSamplesRoot.ExpandAll();
        }
예제 #2
0
 private static void RegisterEntity(Entity ent)
 {
     //var id=SceneView.entities.IndexOf (ent);
     tree.AddNode(ent);
 }