public static string GetCurrentDemoPageTitle() { StringBuilder builder = new StringBuilder(); if (CurrentDemo.IsErrorPage) { builder.Append("Error Page - "); builder.Append(DemosModel.Current.GetSeoTitle()); if (!DemosModel.Current.IsRootDemo) { builder.Append(" Demo"); } } else if (CurrentDemo is IntroPageModel) { builder.Append(CurrentDemo.SeoTitle); } else if (CurrentDemo is DemoPageModel) { string product = DemosModel.Current.GetSeoTitle(); DemoGroupModel demoGroup = ((DemoPageModel)CurrentDemo).Group; string group = demoGroup != null ? demoGroup.SeoTitle : null; builder.Append(CurrentDemo.GetSeoTitle()); builder.Append(" - "); builder.Append(string.IsNullOrEmpty(group) ? product : group); builder.Append(" Demo"); } builder.Append(" | DevExpress"); return(builder.ToString()); }
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); }
static DemoPageModel CreateBogusDemoModel() { DemoGroupModel group = new DemoGroupModel(); group.Title = "ASP.NET"; DemoPageModel result = new DemoPageModel(); result.Group = group; result.HideSourceCode = true; result.Title = BogusDemoTitle; return(result); }
static void RegisterCurrentDemo(string groupKey, string demoKey) { DemoModel demo = null; DemoGroupModel group = DemosModel.Current.FindGroup(groupKey); if (group != null) { demo = group.FindDemo(demoKey); } if (demo == null) { demo = CreateBogusDemoModel(); } Context.Items[CurrentDemoKey] = demo; }
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()); }