コード例 #1
0
        public static void Init(VISite site)
        {
            site.PagesFields.ForEach(
                page =>
            {
                var instance  = (VIPage)Activator.CreateInstance(page.FieldType);
                instance.Site = site;

                var pageAttr = PageAttribute.Handler(instance);
                if (pageAttr == null)
                {
                    instance.SetEmptyPage();
                }
                else
                {
                    instance.FillFromPageAttribute(pageAttr);
                }

                pageAttr = PageAttribute.Handler(page);
                if (pageAttr != null)
                {
                    instance.UpdatePageAttribute(pageAttr);
                }

                page.SetValue(site, instance);

                instance.InitSubElements();
            });
        }
コード例 #2
0
 public static string GetUrlValue(string url, VISite site)
 {
     return((string.IsNullOrEmpty(url))
             ? site.Domain
             : (url.Contains("http://"))
                 ? url
                 : site.Domain.TrimEnd('/') + "/" + url.TrimStart('/'));
 }
コード例 #3
0
        public VIPage(string name, string url = null, string title = null, VISite site = null)
        {
            DefaultNameFunc = () => string.Format("Page with Title: '{0}', Url: '{1}'", Title ?? "", Url ?? "");
            if (!string.IsNullOrEmpty(name))
            {
                Name = name;
            }
            else
            {
                name = NameAttribute.GetName(this);
                if (!string.IsNullOrEmpty(name))
                {
                    Name = name;
                }
            }
            if (site != null)
            {
                Site = site;
            }
            var pageAttr = PageAttribute.Handler(this);

            if (pageAttr != null)
            {
                FillFromPageAttribute(pageAttr);
            }
            else
            {
                SetEmptyPage();
            }
            if (!string.IsNullOrEmpty(url))
            {
                Url = url;
            }
            if (!string.IsNullOrEmpty(title))
            {
                Title = title;
            }
        }
コード例 #4
0
 public Navigation(VISite site)
 {
     PagesHistory    = new List <VIPage>();
     _currentPageNum = -1;
     _site           = site;
 }