コード例 #1
0
        private static List <ControlPage> GetControlPagesFromXEle(XElement controlElement, string controlName)
        {
            var pages = controlElement.Elements("action").Select(e =>
            {
                var enhancedAttr = e.Attribute("enhanced");
                var isEnhanced   = false;
                if (enhancedAttr != null)
                {
                    bool.TryParse(enhancedAttr.Value, out isEnhanced);
                }

                ControlPage page = new ControlPage
                {
                    TextEn       = e.Attribute("text").Value,
                    TextJp       = e.Attribute("text.ja")?.Value,
                    Name         = e.Attribute("name") != null ? e.Attribute("name").Value : "",
                    ControlName  = controlName,
                    IsEnhanced   = isEnhanced,
                    EnhanceTipEn = e.Attribute("enhancetip")?.Value,
                    EnhanceTipJp = e.Attribute("enhancetip.ja")?.Value
                };
                if (e.Element("subactions") != null)
                {
                    List <ControlPage> subPages = GetControlPagesFromXEle(e.Element("subactions"), controlName);
                    if (subPages.Count() > 0)
                    {
                        page.SubPages = subPages;
                    }
                }

                return(page);
            }).ToList();

            return(pages);
        }
コード例 #2
0
 public static void setPagePath(IUrlHelper urlHelper, ControlPage page)
 {
     if (page.SubPages != null && page.SubPages.Count > 0)
     {
         foreach (var subPage in page.SubPages)
         {
             setPagePath(urlHelper, subPage);
         }
     }
     else if (String.IsNullOrEmpty(page.Path))
     {
         page.Path = string.IsNullOrEmpty(page.Name) ? null : urlHelper.Action(page.Name, page.ControlName).ToString();
     }
 }