Ejemplo n.º 1
0
        private static void RegisterCurrentDemo(string groupKey, string demoKey)
        {
            DemoModel demo = null;

            if (IsIntroPage(groupKey, demoKey))
            {
                demo = DemosModel.Current.Intro;
            }
            else
            {
                if (IsOverviewPage(demoKey) && String.IsNullOrEmpty(groupKey))
                {
                    demo = DemosModel.Current.Overview;
                }
                else
                {
                    var group = DemosModel.Current.FindGroup(groupKey);
                    if (group != null)
                    {
                        demo = group.FindDemo(demoKey);
                    }
                }
            }
            if (demo == null)
            {
                demo = CreateBogusDemoModel();
            }
            Context.Items[CurrentDemoKey] = demo;
            DevExpress.Web.ASPxClasses.Internal.DemoUtils.RegisterDemo(DemosModel.Current.Key, groupKey, demoKey);
        }
Ejemplo n.º 2
0
 public SearchResult(DemoModel demo, int rank)
 {
     Demo    = demo;
     Rank    = rank;
     Product = demo.Product;
     if (demo is DemoPageModel)
     {
         Group = (demo as DemoPageModel).Group;
     }
 }
Ejemplo n.º 3
0
        public static string GetDemoTitleHtml(DemoModel demo)
        {
            var result = string.Empty;

            if (demo is DemoPageModel)
            {
                result = string.Format("{0} - {1}", ((DemoPageModel)demo).Group.Title, demo.Title);
            }
            if (string.IsNullOrEmpty(result))
            {
                result = demo.Title;
            }
            else
            {
                if (result.Length > 60)
                {
                    result = demo.Title;
                }
            }
            return(HttpUtility.HtmlEncode(result));
        }
Ejemplo n.º 4
0
        public static string GenerateDemoUrl(DemoModel demo)
        {
            if (!string.IsNullOrEmpty(demo.HighlightedLink))
            {
                return(demo.HighlightedLink);
            }
            var str = new StringBuilder();

            if (demo.Product.IsCurrent)
            {
                str.Append("~/");
            }
            else
            {
                var url        = HttpContext.Current.Request.Url.AbsolutePath;
                var productUrl = "/" + CurrentDemo.Product.Url;
                url = url.Substring(0, url.IndexOf(productUrl, StringComparison.InvariantCultureIgnoreCase) + 1);
                str.AppendFormat("{0}{1}/", url, demo.Product.Url);
            }

            var demoGroup = demo is DemoPageModel ? ((DemoPageModel)demo).Group : null;

            if (demoGroup != null && !string.IsNullOrEmpty(demoGroup.Key))
            {
                str.Append(demoGroup.Key);
                str.Append("/");
            }
            if (!IsMvc || !string.Equals("Index", demo.Key))
            {
                str.Append(demo.Key);
            }
            if (!IsMvc)
            {
                str.Append(".aspx");
            }
            return(str.ToString());
        }
Ejemplo n.º 5
0
 private int CompareHighlightedDemos(DemoModel x, DemoModel y)
 {
     return(Comparer <int> .Default.Compare(x.HighlightedIndex, y.HighlightedIndex));
 }