internal Element_ToastVisual ConvertToElement() { var visual = new Element_ToastVisual() { Version = Version, Language = Language, BaseUri = BaseUri, AddImageQuery = AddImageQuery }; Element_ToastBinding binding = new Element_ToastBinding(ToastTemplateType.ToastGeneric); if (TitleText == null) { // If there's subsequent text, add a blank line of text if (BodyTextLine1 != null || BodyTextLine2 != null) binding.Children.Add(new Element_ToastText()); } else binding.Children.Add(TitleText.ConvertToElement()); if (BodyTextLine1 == null) { // If there's subsequent text, add a blank line of text if (BodyTextLine2 != null) binding.Children.Add(new Element_ToastText()); } else binding.Children.Add(BodyTextLine1.ConvertToElement()); if (BodyTextLine2 != null) binding.Children.Add(BodyTextLine2.ConvertToElement()); // Add inline images foreach (var img in InlineImages) binding.Children.Add(img.ConvertToElement()); // And if there's an app logo override, add it if (AppLogoOverride != null) binding.Children.Add(AppLogoOverride.ConvertToElement()); // TODO: If a BaseUri wasn't provided, we can potentially optimize the payload size by calculating the best BaseUri visual.Bindings.Add(binding); return visual; }
internal Element_ToastBinding ConvertToElement() { Element_ToastBinding binding = new Element_ToastBinding(ToastTemplateType.ToastGeneric) { BaseUri = BaseUri, AddImageQuery = AddImageQuery, Language = Language }; // Add children foreach (var child in Children) { var el = (IElement_ToastBindingChild)AdaptiveHelper.ConvertToElement(child); binding.Children.Add(el); } // Add attribution if (Attribution != null) { binding.Children.Add(Attribution.ConvertToElement()); } // If there's hero, add it if (HeroImage != null) { binding.Children.Add(HeroImage.ConvertToElement()); } // If there's app logo, add it if (AppLogoOverride != null) { binding.Children.Add(AppLogoOverride.ConvertToElement()); } return(binding); }
internal Element_ToastVisual ConvertToElement() { var visual = new Element_ToastVisual() { Version = Version, Language = Language, BaseUri = BaseUri, AddImageQuery = AddImageQuery }; Element_ToastBinding binding = new Element_ToastBinding(ToastTemplateType.ToastGeneric); if (TitleText == null) { // If there's subsequent text, add a blank line of text if (BodyTextLine1 != null || BodyTextLine2 != null) { binding.Children.Add(new Element_ToastText()); } } else { binding.Children.Add(TitleText.ConvertToElement()); } if (BodyTextLine1 == null) { // If there's subsequent text, add a blank line of text if (BodyTextLine2 != null) { binding.Children.Add(new Element_ToastText()); } } else { binding.Children.Add(BodyTextLine1.ConvertToElement()); } if (BodyTextLine2 != null) { binding.Children.Add(BodyTextLine2.ConvertToElement()); } // Add inline images foreach (var img in InlineImages) { binding.Children.Add(img.ConvertToElement()); } // And if there's an app logo override, add it if (AppLogoOverride != null) { binding.Children.Add(AppLogoOverride.ConvertToElement()); } // TODO: If a BaseUri wasn't provided, we can potentially optimize the payload size by calculating the best BaseUri visual.Bindings.Add(binding); return(visual); }