bool IWebContextualApplicationType.IsCurrentApplicationType(TeUi.IWebContext context) { bool isCurrentMapBookType = false; bool maybeMapBookTypes = (context.Url.Contains("/mapbooks/")) ? true : false; //to be current Application requires "/mapbooks/" maybe it is bool maybeCurrentMapBookType = (!context.Url.EndsWith("/mapbooks/") && maybeMapBookTypes) ? true : false; //if the url doesn't end with if (TEApi.Url.CurrentContext != null && maybeCurrentMapBookType) { var item = TEApi.Url.CurrentContext.ContextItems.Find(c => c.ApplicationTypeId.Value == ApplicationTypeId);//.GetAllContextItems(); isCurrentMapBookType = (item != null && item.ApplicationId.HasValue) ? true : false; } return(isCurrentMapBookType); }
public IApplication GetCurrentApplication(TeUi.IWebContext context) { PublicApi.MapBook mapbook = new PublicApi.MapBook(); IApplication app = mapbook as IApplication; if (TEApi.Url.CurrentContext == null) { return(null); } var item = TEApi.Url.CurrentContext.ContextItems.Find(c => c.ApplicationTypeId.Value == ApplicationTypeId);//.GetAllContextItems(); if (item != null && item.ApplicationId.HasValue) { return(PublicApi.MapBooks.Get(item.ApplicationId.Value)); } return(null); }