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 if (IsErrorPage(demoKey)) { demo = CreateErrorPageDemoModel(); } else { DemoGroupModel group = DemosModel.Current.FindGroup(groupKey); if (group != null) { demo = group.FindDemo(demoKey); } } if (demo == null) { demo = CreateBogusDemoModel(); } Context.Items[CurrentDemoKey] = demo; DevExpress.Web.Internal.DemoUtils.RegisterDemo(DemosModel.Current.Key, groupKey, demoKey); }
public SearchResult(DemoModel demo, int rank) { this.Demo = demo; this.Rank = rank; Product = demo.Product; if (demo is DemoPageModel) { Group = (demo as DemoPageModel).Group; } }
public static string GetDemoTitleHtml(DemoModel demo) { string 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)); }
public static string GenerateDemoUrl(DemoModel demo) { if (!string.IsNullOrEmpty(demo.HighlightedLink)) { return(demo.HighlightedLink); } StringBuilder 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); } DemoGroupModel 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()); }
int CompareHighlightedDemos(DemoModel x, DemoModel y) { return(Comparer <int> .Default.Compare(x.HighlightedIndex, y.HighlightedIndex)); }
int CompareHighlightedDemos(DemoModel x, DemoModel y) { return Comparer<int>.Default.Compare(x.HighlightedIndex, y.HighlightedIndex); }