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); }