예제 #1
0
        public void InitGUI(ref XmlDocument doc)
        {
            _log.WriteLn("In maps InitGUI");
            IUIManager    uIManager = Repository.Instance.GetManager <IUIManager>();
            StringBuilder xmlStr    = new StringBuilder();

            xmlStr.Append(@"<AccordionSection expanded=""0"" name=""Maps"">
                <AccordionSectionHeader>
                    <AccordionSectionHeaderIcon />
                    <Text>Maps</Text>
                </AccordionSectionHeader>
                      
                <AccordionSectionContent> 
                    <VerticalScrollView>        
                        <VerticalLayout>
             ");
            DirectoryInfo   di       = new DirectoryInfo(_rootPath + "/maps");
            List <FileInfo> fileList = new List <FileInfo>();

            FileSystemUtils.VisitFileTree(di, null, null, (FileInfo fi) => {
                if (Path.GetExtension(fi.Name) != ".meta")
                {
                    fileList.Add(fi);
                }
            });
            foreach (FileInfo fi in fileList)
            {
                xmlStr.Append(@"<Text onClick=""SendParamEvent(MAPBUTTONEVT,");
                xmlStr.Append(fi.FullName);
                xmlStr.Append(@")"">");
                xmlStr.Append(Path.GetFileNameWithoutExtension(fi.Name));
                xmlStr.Append("</Text>\n");
            }
            _log.WriteLn(xmlStr.ToString());
            xmlStr.Append(@"
                        </VerticalLayout>  
                    </VerticalScrollView>
                </AccordionSectionContent>  
            </AccordionSection>");
            XmlManipulator manip = new XmlManipulator(doc.OuterXml);

            manip.AddStringToNodeID("AccordianX", xmlStr.ToString());
            doc.LoadXml(manip.Text);
            //_log.WriteLn(doc.OuterXml);
            uIManager.AddUIEventHandler("MAPBUTTONEVT", ButtonCB);
        }