/// <summary> /// Creates a toast notification template and populates it with the given data. /// </summary> /// <param name="beaconActionType"></param> /// <param name="subject"></param> /// <param name="body"></param> /// <param name="url"></param> /// <returns>A newly created toast notification template.</returns> public static XmlDocument CreateToastTemplate(BeaconActionType beaconActionType, string subject, string body, string url) { XmlDocument toastTemplate = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText04); XmlNodeList toastTextAttributes = toastTemplate.GetElementsByTagName(KeyText); int textAttributeIndex = 0; if (!string.IsNullOrEmpty(subject)) { toastTextAttributes[textAttributeIndex].InnerText = subject; textAttributeIndex++; } if (!string.IsNullOrEmpty(body)) { toastTextAttributes[textAttributeIndex].InnerText = body; textAttributeIndex++; } if (!string.IsNullOrEmpty(url)) { toastTextAttributes[textAttributeIndex].InnerText = url; } return toastTemplate; }
/// <summary> /// Creates a toast notification template and populates it with the given data. /// </summary> /// <param name="beaconActionType"></param> /// <param name="subject"></param> /// <param name="body"></param> /// <param name="url"></param> /// <returns>A newly created toast notification template.</returns> public static XmlDocument CreateToastTemplate(BeaconActionType beaconActionType, string subject, string body, string url) { XmlDocument toastTemplate = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText04); XmlNodeList toastTextAttributes = toastTemplate.GetElementsByTagName(KeyText); int textAttributeIndex = 0; if (!string.IsNullOrEmpty(subject)) { toastTextAttributes[textAttributeIndex].InnerText = subject; textAttributeIndex++; } if (!string.IsNullOrEmpty(body)) { toastTextAttributes[textAttributeIndex].InnerText = body; textAttributeIndex++; } if (!string.IsNullOrEmpty(url)) { toastTextAttributes[textAttributeIndex].InnerText = url; } return(toastTemplate); }