public void Parse(ParseContext context) { var templateString = context.TemplateString; var template = templateString.Template; var builder = new StringBuilder(template); var variables = templateString.Variables; var parsed = false; foreach (var variable in variables) { var variableValue = GetVariableValue(context, variable); var replaceValue = TemplateUtilities.GetReplaceText(variable); if (template.IndexOf(replaceValue, StringComparison.OrdinalIgnoreCase) == -1) { continue; } parsed = true; builder.Replace(replaceValue, variableValue); } context.Result = parsed ? TemplateUtilities.Escaped(builder.ToString()) : template; }
private void ContentService_Published(IContentService sender, ContentPublishedEventArgs e) { foreach (var item in e.PublishedEntities) { if (item.ContentType.Alias == "page") { try { bywhoEntities db = new bywhoEntities(); int pguid = item.GetValue <int>("pageId"); var topic = db.Topic.FirstOrDefault(x => x.Id == pguid); var baseURL = "/cms"; if (topic != null) { topic.Title = item.GetValue <string>("title"); topic.SystemName = item.GetValue <string>("systemName"); topic.BodyTekst = TemplateUtilities.ResolveMediaFromTextString(item.GetValue <string>("bodyText")); topic.IsPage = item.GetValue <bool>("isPage"); topic.SeoTitle = item.GetValue <string>("seoTitle"); topic.SeoDescription = item.GetValue <string>("seoDescription"); topic.SeoKeywords = item.GetValue <string>("seoKeywords"); topic.NoFollow = item.GetValue <bool>("noFollow"); db.SaveChanges(); } } catch (Exception ex) { } } } }
/// <summary> /// Renders the specified item. /// </summary> /// <param name="item">The item.</param> /// <param name="writer">The writer.</param> public virtual void Render(Item item, HtmlTextWriter writer) { if (item.DebugMode) { writer.AddAttribute(HtmlTextWriterAttribute.Title, string.Format("Field Tag: '{0}'", item.Field)); writer.AddAttribute("style", "border: 1px solid #fc6;"); writer.RenderBeginTag(HtmlTextWriterTag.Div); } try { StringWriter renderOutputWriter = new StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(renderOutputWriter); foreach (Control control in item.Controls) { try { control.RenderControl(htmlWriter); } catch (Exception renderException) { // TODO: Validate that the current control is within the scope of a form control // Even controls that are inside this scope, can produce this error in async postback. HttpContext.Current.Trace.Warn("ItemRenderer", String.Format("Error rendering control {0} of {1}.", control.ClientID, item), renderException); } } // parse macros and execute the XSLT transformation on the result if not empty string renderOutput = renderOutputWriter.ToString(); string xsltTransformedOutput = renderOutput.Trim().Length == 0 ? String.Empty : XsltTransform(item.Xslt, renderOutput, item.XsltDisableEscaping); // handle text before/after xsltTransformedOutput = AddBeforeAfterText(xsltTransformedOutput, helper.FindAttribute(item.LegacyAttributes, "insertTextBefore"), helper.FindAttribute(item.LegacyAttributes, "insertTextAfter")); string finalResult = xsltTransformedOutput.Trim().Length > 0 ? xsltTransformedOutput : GetEmptyText(item); //Don't parse urls if a content item is assigned since that is taken care // of with the value converters if (item.ContentItem == null) { writer.Write(TemplateUtilities.ResolveUrlsFromTextString(finalResult)); } else { writer.Write(finalResult); } } catch (Exception renderException) { HttpContext.Current.Trace.Warn("ItemRenderer", String.Format("Error rendering {0}.", item), renderException); } finally { if (item.DebugMode) { writer.RenderEndTag(); } } }
/// <summary> /// Processes the value. /// </summary> /// <returns> /// The <see cref="object" /> representing the processed value. /// </returns> public override object ProcessValue() { if (typeof(IHtmlString).IsAssignableFrom(this.Context.PropertyInfo.PropertyType)) { if (this.Value is string text && string.IsNullOrWhiteSpace(text) == false) { text = text .Replace("\r\n", "<br />") .Replace("\n", "<br />") .Replace("\r", "<br />"); return(new HtmlString(text)); } if (this.Value is HtmlString) { var html = this.Value.ToString(); if (string.IsNullOrWhiteSpace(html) == false) { html = TemplateUtilities.ParseInternalLinks(html); } return(new HtmlString(html)); } if (this.Value is DynamicXml) { return(((DynamicXml)this.Value).ToHtml()); } } return(this.Value); }
/// <summary> /// Occurs when a new update is added to the Live Editing update collection. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="UpdateAddedEventArgs"/> instance containing the event data.</param> protected void Updates_UpdateAdded(object sender, UpdateAddedEventArgs e) { ItemUpdate update = e.Update as ItemUpdate; if (update != null) { List <Item> affectedItems = Utility.FindControls <Item>(item => item.GetParsedNodeId() == update.NodeId && item.Field == update.Field, Page.Master); foreach (Item affectedItem in affectedItems) { // render the item, temporarily disabling the live editing special output StringWriter itemRenderOutput = new StringWriter(); bool liveEditingWasDisabled = affectedItem.LiveEditingDisabled; affectedItem.LiveEditingDisabled = true; affectedItem.RenderControl(new HtmlTextWriter(itemRenderOutput)); affectedItem.LiveEditingDisabled = liveEditingWasDisabled; // add the item's contents to the output HtmlGenericControl itemUpdate = new HtmlGenericControl("umbraco:itemupdate"); itemUpdate.Attributes["itemId"] = affectedItem.ItemId.ToString(); itemUpdate.InnerHtml = TemplateUtilities.ParseInternalLinks(itemRenderOutput.ToString()); itemUpdate.EnableViewState = false; m_Manager.AddClientOutput(itemUpdate); } } }
public async Task <ActionResult> Save(InviteTemplate template) { if (ModelState.IsValid) { //check for subject template if smtp if (Settings.UseSMTP) { if (string.IsNullOrEmpty(template.SubjectTemplate)) { ModelState.AddModelError("SubjectTemplate", "With SMTP enabled, the subject template is required."); return(View("Edit", template)); } } try { template.TemplateAuthor = User.Identity.GetEmail(); if (template.Id == null) { template = await TemplateUtilities.AddTemplate(template); } else { template = await TemplateUtilities.UpdateTemplate(template); } return(RedirectToAction("Index")); } catch { return(View("Edit", template)); } } return(View("Edit", template)); }
protected override void Render(HtmlTextWriter writer) { // do the original rendering TextWriter sw = new StringWriter(); base.Render(new HtmlTextWriter(sw)); string text = sw.ToString(); // filter / parse internal links - although this should be done elsewhere! text = TemplateUtilities.ParseInternalLinks(text); // filter / add preview banner if (UmbracoContext.Current.InPreviewMode) { LogHelper.Debug <UmbracoDefault>("Umbraco is running in preview mode.", true); if (Response.ContentType.InvariantEquals("text/html")) // ASP.NET default value { int pos = text.ToLower().IndexOf("</body>"); if (pos > -1) { string htmlBadge = String.Format(UmbracoSettings.PreviewBadge, IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); text = text.Substring(0, pos) + htmlBadge + text.Substring(pos, text.Length - pos); } } } // render writer.Write(text); }
private string Convert(object source, bool preview) { if (source == null) { return(null); } var sourceString = source.ToString(); // ensures string is parsed for {localLink} and urls and media are resolved correctly sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview, Current.UmbracoContext); sourceString = TemplateUtilities.ResolveUrlsFromTextString(sourceString); sourceString = TemplateUtilities.ResolveMediaFromTextString(sourceString); // ensure string is parsed for macros and macros are executed correctly sourceString = RenderRteMacros(sourceString, preview); // find and remove the rel attributes used in the Umbraco UI from img tags var doc = new HtmlDocument(); doc.LoadHtml(sourceString); if (doc.ParseErrors.Any() == false && doc.DocumentNode != null) { // Find all images with rel attribute var imgNodes = doc.DocumentNode.SelectNodes("//img[@rel]"); var modified = false; if (imgNodes != null) { foreach (var img in imgNodes) { var nodeId = img.GetAttributeValue("rel", string.Empty); if (int.TryParse(nodeId, out _)) { img.Attributes.Remove("rel"); modified = true; } } } // Find all a and img tags with a data-udi attribute var dataUdiNodes = doc.DocumentNode.SelectNodes("(//a|//img)[@data-udi]"); if (dataUdiNodes != null) { foreach (var node in dataUdiNodes) { node.Attributes.Remove("data-udi"); modified = true; } } if (modified) { return(doc.DocumentNode.OuterHtml); } } return(sourceString); }
public static void ApplyConfiguration() { // Apply database configuration ConfigurationSection sqlDbConfiguration = TridionConfig.ConfigurationManager.TryGetSection(DbConfiguration.SectionName); // Use reflection because SDL 2011 and SDL 2013 have different configuration structures Action <String, Object> setProperty = (Action <String, Object>)Delegate.CreateDelegate(typeof(Action <String, Object>), sqlDbConfiguration, typeof(ConfigurationElement).GetProperty("Item", BindingFlags.Instance | BindingFlags.NonPublic, null, typeof(Object), new Type[] { typeof(String) }, new ParameterModifier[] { }) .GetSetMethod(true)); if (sqlDbConfiguration != null) { setProperty("name", DebuggerConfig.Instance.Database.Name); setProperty("server", DebuggerConfig.Instance.Database.Server); setProperty("username", DebuggerConfig.Instance.Database.Username); setProperty("password", DebuggerConfig.Instance.Database.Password); } // Configure TRIDION_CM_HOME for the SchemaCache to find the required XSD files String rendererFolder = Path.GetFullPath(Path.Combine(ApplicationPath, DebuggerConfig.Instance.Templating.SchemaCache)); Environment.SetEnvironmentVariable("TRIDION_CM_HOME", rendererFolder); // Enable impersonation for the current windows user? if (DebuggerConfig.Instance.Templating.EnableImpersonation) { ContentManagerSecurityConfiguration section = TridionConfig.ConfigurationManager.TryGetSection(ContentManagerSecurityConfiguration.SectionName) as ContentManagerSecurityConfiguration; if (section != null) { section.ImpersonationUsers.Add( new ImpersonationUserSettings() { Name = WindowsIdentity.GetCurrent().Name, ImpersonationType = ImpersonationType.Windows }); } } // Enable templating settings and load the WrappedMediator TemplatingSettings templatingSettings = TemplateUtilities.GetTemplatingSettings(); if (templatingSettings != null) { templatingSettings.DebuggingElement.PdbLocation = ApplicationPath; MediatorElement mediatorElement = templatingSettings.MediatorCollection .Cast <MediatorElement>() .FirstOrDefault(me => String.Equals(me.MatchMimeType, "text/x-tcm-csharpfragment")); if (mediatorElement != null) { // Ensure the wrapped mediator is initialized (this loads the configured debug libraries) WrappedCSharpMediator.Initialize(); mediatorElement.ClassName = typeof(WrappedCSharpMediator).AssemblyQualifiedName; } } }
public static string Parse(this ITemplateParser parser, string contengt, IDictionary <string, string> arguments) { var context = new ParseContext(new TemplateString(contengt, TemplateUtilities.GetVariables(contengt)), arguments); parser.Parse(context); return(context.Result); }
public SiteConfigController() { var task = Task.Run(async() => { _templates = (await TemplateUtilities.GetTemplates()).ToList(); }); task.Wait(); }
public string OpenTemplateDialog(long id) { var log = new SysLogModel(); var json = TemplateUtilities.OpenTemplateDialog(id); log.Finish(json.Length); return(json); }
public PreApprovalController() { var task = Task.Run(async() => { _templates = (await TemplateUtilities.GetTemplates()).ToList(); _groups = (await new GraphUtil().GetGroups()).ToList(); }); task.Wait(); }
void InitializeTemplates() { _defaultMenuItemAdder = content => new DefaultMenuItem().SetContent(content); addLoadingPageAsService = services => services.AddSingleton <ILoadingPage, LoadingPage>() .AddSingleton <LoadingPage>(); templateUtilities = new TemplateUtilities { StartLoading = async() => await Services.NavigateAsync <LoadingPage>() }; }
public override object ConvertSourceToIntermediate(IPublishedElement owner, PublishedPropertyType propertyType, object source, bool preview) { if (source == null) { return(null); } var sourceString = source.ToString(); // ensures string is parsed for {localLink} and urls and media are resolved correctly sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview, Current.UmbracoContext); sourceString = TemplateUtilities.ResolveUrlsFromTextString(sourceString); sourceString = TemplateUtilities.ResolveMediaFromTextString(sourceString); // ensure string is parsed for macros and macros are executed correctly sourceString = RenderRteMacros(sourceString, preview); // find and remove the rel attributes used in the Umbraco UI from img tags var doc = new HtmlDocument(); doc.LoadHtml(sourceString); if (doc.ParseErrors.Any() == false && doc.DocumentNode != null) { // Find all images with rel attribute var imgNodes = doc.DocumentNode.SelectNodes("//img[@rel]"); if (imgNodes != null) { var modified = false; foreach (var img in imgNodes) { var firstOrDefault = img.Attributes.FirstOrDefault(x => x.Name == "rel"); if (firstOrDefault != null) { var rel = firstOrDefault.Value; // Check that the rel attribute is a integer before removing int nodeId; if (int.TryParse(rel, out nodeId)) { img.Attributes.Remove("rel"); modified = true; } } } if (modified) { return(doc.DocumentNode.OuterHtml); } } } return(sourceString); }
public async Task <ActionResult> Index() { var templates = await TemplateUtilities.GetTemplates(); if (templates.Count() == 0) { templates = await TemplateUtilities.InitializeDefaultTemplate(User.Identity.GetEmail()); } return(View(templates)); }
public object Convert(object value) { using (var cRef = _umbracoContextFactory.EnsureUmbracoContext()) { var parsedHtml = TemplateUtilities.ParseInternalLinks( value.ToString(), cRef.UmbracoContext.UrlProvider); return(parsedHtml); } }
public void ParseLocalLinks(string input, string result) { var serviceCtxMock = new TestObjects(null).GetServiceContextMock(); //setup a mock entity service from the service context to return an integer for a GUID var entityService = Mock.Get(serviceCtxMock.EntityService); //entityService.Setup(x => x.GetId(It.IsAny<Guid>(), It.IsAny<UmbracoObjectTypes>())) // .Returns((Guid id, UmbracoObjectTypes objType) => // { // return Attempt.Succeed(1234); // }); //setup a mock url provider which we'll use fo rtesting var testUrlProvider = new Mock <IUrlProvider>(); testUrlProvider .Setup(x => x.GetUrl(It.IsAny <UmbracoContext>(), It.IsAny <IPublishedContent>(), It.IsAny <UrlProviderMode>(), It.IsAny <string>(), It.IsAny <Uri>())) .Returns((UmbracoContext umbCtx, IPublishedContent content, UrlProviderMode mode, string culture, Uri url) => UrlInfo.Url("/my-test-url")); var globalSettings = SettingsForTests.GenerateMockGlobalSettings(); var contentType = new PublishedContentType(666, "alias", PublishedItemType.Content, Enumerable.Empty <string>(), Enumerable.Empty <PublishedPropertyType>(), ContentVariation.Nothing); var publishedContent = Mock.Of <IPublishedContent>(); Mock.Get(publishedContent).Setup(x => x.Id).Returns(1234); Mock.Get(publishedContent).Setup(x => x.ContentType).Returns(contentType); var contentCache = Mock.Of <IPublishedContentCache>(); Mock.Get(contentCache).Setup(x => x.GetById(It.IsAny <int>())).Returns(publishedContent); Mock.Get(contentCache).Setup(x => x.GetById(It.IsAny <Guid>())).Returns(publishedContent); var snapshot = Mock.Of <IPublishedSnapshot>(); Mock.Get(snapshot).Setup(x => x.Content).Returns(contentCache); var snapshotService = Mock.Of <IPublishedSnapshotService>(); Mock.Get(snapshotService).Setup(x => x.CreatePublishedSnapshot(It.IsAny <string>())).Returns(snapshot); using (var umbCtx = UmbracoContext.EnsureContext( Umbraco.Web.Composing.Current.UmbracoContextAccessor, Mock.Of <HttpContextBase>(), snapshotService, new Mock <WebSecurity>(null, null, globalSettings).Object, //setup a quick mock of the WebRouting section Mock.Of <IUmbracoSettingsSection>(section => section.WebRouting == Mock.Of <IWebRoutingSection>(routingSection => routingSection.UrlProviderMode == "AutoLegacy")), //pass in the custom url provider new[] { testUrlProvider.Object }, globalSettings, new TestVariationContextAccessor(), true)) { var output = TemplateUtilities.ParseInternalLinks(input, umbCtx.UrlProvider); Assert.AreEqual(result, output); } }
// GET: Admin/BulkInvite public async Task <ActionResult> Index() { var res = new List <SelectListItem>(); var templates = (await TemplateUtilities.GetTemplates()).ToList(); res.AddRange(templates.Select(t => new SelectListItem { Selected = (t.TemplateName == "Default"), Text = t.TemplateName, Value = t.Id })); ViewBag.Templates = res; return(View()); }
/// <summary> /// Format the data for the editor /// </summary> /// <param name="property"></param> /// <param name="propertyType"></param> /// <param name="dataTypeService"></param> /// <returns></returns> public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { if (property.Value == null) { return(null); } var propertyValueWithMediaResolved = TemplateUtilities.ResolveMediaFromTextString(property.Value.ToString()); var parsed = MacroTagParser.FormatRichTextPersistedDataForEditor(propertyValueWithMediaResolved, new Dictionary <string, string>()); return(parsed); }
public void ParseLocalLinks(string input, string result) { //setup a mock url provider which we'll use for testing var testUrlProvider = new Mock <IUrlProvider>(); testUrlProvider .Setup(x => x.GetUrl(It.IsAny <UmbracoContext>(), It.IsAny <IPublishedContent>(), It.IsAny <UrlMode>(), It.IsAny <string>(), It.IsAny <Uri>())) .Returns((UmbracoContext umbCtx, IPublishedContent content, UrlMode mode, string culture, Uri url) => UrlInfo.Url("/my-test-url")); var globalSettings = SettingsForTests.GenerateMockGlobalSettings(); var contentType = new PublishedContentType(666, "alias", PublishedItemType.Content, Enumerable.Empty <string>(), Enumerable.Empty <PublishedPropertyType>(), ContentVariation.Nothing); var publishedContent = Mock.Of <IPublishedContent>(); Mock.Get(publishedContent).Setup(x => x.Id).Returns(1234); Mock.Get(publishedContent).Setup(x => x.ContentType).Returns(contentType); var contentCache = Mock.Of <IPublishedContentCache>(); Mock.Get(contentCache).Setup(x => x.GetById(It.IsAny <int>())).Returns(publishedContent); Mock.Get(contentCache).Setup(x => x.GetById(It.IsAny <Guid>())).Returns(publishedContent); var snapshot = Mock.Of <IPublishedSnapshot>(); Mock.Get(snapshot).Setup(x => x.Content).Returns(contentCache); var snapshotService = Mock.Of <IPublishedSnapshotService>(); Mock.Get(snapshotService).Setup(x => x.CreatePublishedSnapshot(It.IsAny <string>())).Returns(snapshot); var media = Mock.Of <IPublishedContent>(); Mock.Get(media).Setup(x => x.Url).Returns("/media/1001/my-image.jpg"); var mediaCache = Mock.Of <IPublishedMediaCache>(); Mock.Get(mediaCache).Setup(x => x.GetById(It.IsAny <Guid>())).Returns(media); var umbracoContextAccessor = new TestUmbracoContextAccessor(); var umbracoContextFactory = new UmbracoContextFactory( umbracoContextAccessor, snapshotService, new TestVariationContextAccessor(), new TestDefaultCultureAccessor(), Mock.Of <IUmbracoSettingsSection>(section => section.WebRouting == Mock.Of <IWebRoutingSection>(routingSection => routingSection.UrlProviderMode == "Auto")), globalSettings, new UrlProviderCollection(new[] { testUrlProvider.Object }), new MediaUrlProviderCollection(Enumerable.Empty <IMediaUrlProvider>()), Mock.Of <IUserService>()); using (var reference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of <HttpContextBase>())) { var output = TemplateUtilities.ParseInternalLinks(input, reference.UmbracoContext.UrlProvider, mediaCache); Assert.AreEqual(result, output); } }
static async Task <Element> FindDataSourceParentAsync(Element element) { while (!Application.IsApplicationOrNull(element)) { if (element is IDataSourceProvider) { return(element); } element = await TemplateUtilities.GetRealParentAsync(element); } return(null); }
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) { if (source == null) { return(null); } var sourceString = source.ToString(); // ensures string is parsed for {localLink} and urls are resolved correctly sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview); sourceString = TemplateUtilities.ResolveUrlsFromTextString(sourceString); return(sourceString); }
public override object ConvertSourceToIntermediate(IPublishedElement owner, PublishedPropertyType propertyType, object source, bool preview) { if (source == null) { return(null); } var sourceString = source.ToString(); // ensures string is parsed for {localLink} and urls are resolved correctly sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview, UmbracoContext.Current); sourceString = TemplateUtilities.ResolveUrlsFromTextString(sourceString); return(sourceString); }
public async Task <ActionResult> Delete(InviteTemplate template) { try { await TemplateUtilities.DeleteTemplate(template); return(RedirectToAction("Index")); } catch { ViewBag.Operation = "Delete"; return(RedirectToAction("Index")); } }
private static object GetTypedVaue(string alias, object value) { switch (alias) { case GridAliases.Headline: case GridAliases.Quote: return(value.ToString()); case GridAliases.Rte: return(new MvcHtmlString(TemplateUtilities.ParseInternalLinks(value.ToString()))); default: return(string.Empty); } }
/// <summary> /// Renders the macro script. /// </summary> /// <param name="helper">The helper.</param> /// <param name="language">The language.</param> /// <param name="fileLocation">The file location.</param> /// <param name="parameters">The parameters.</param> /// <returns></returns> public static IHtmlString RenderMacroScript(this UmbracoHelper helper, string language, string fileLocation, IDictionary <string, object> parameters) { var ctrl = new umbraco.presentation.templateControls.Macro() { Language = language, FileLocation = fileLocation, }; foreach (var parameter in parameters) { ctrl.Attributes.Add(parameter.Key, parameter.Value.ToString()); } return(new HtmlString(TemplateUtilities.ParseInternalLinks(ctrl.RenderToString()))); }
public async Task <ActionResult> Edit(string id) { InviteTemplate template; if (id == null) { ViewBag.Operation = "New"; template = new InviteTemplate(); } else { ViewBag.Operation = "Edit"; template = await TemplateUtilities.GetTemplate(id); } return(View(template)); }
/// <summary> /// Get an Iterator of all the link attribute values in the document. /// </summary> /// <param name="expressions">The regular expressions to execute on the text</param> /// <returns>An enumerator of link attribute matches.</returns> internal IEnumerable <LinkReferenceWrapper> GetLinkAttributes(Regex[] expressions) { string[] templateStringContainer = new string[] { _contentString };; foreach (Regex expression in expressions) { foreach (Match linkMatch in TemplateUtilities.GetRegexMatches(templateStringContainer, expression)) { LinkReferenceWrapper linkAttribute = new LinkReferenceWrapper(linkMatch); linkAttribute._linkPosition = linkMatch.Groups[MATCH_PATH_GROUP_NAME]; linkAttribute._attributeName = linkMatch.Groups[MATCH_NAME_GROUP_NAME].ToString(); linkAttribute._outputPathAttributeValue = _contentString.Substring (linkAttribute._linkPosition.Index, linkAttribute._linkPosition.Length); yield return(linkAttribute); templateStringContainer[0] = _contentString; } } }
public void OnControlTemplateChanged() { tlog.Debug(tag, $"OnControlTemplateChanged START"); try { var view = new MyView(); var child = new MyView(); child.Parent = view; TemplateUtilities.OnControlTemplateChanged(view, "old", "new"); } catch (Exception e) { Assert.Fail("Catch exception" + e.Message.ToString()); } tlog.Debug(tag, $"OnControlTemplateChanged END"); }