public object ConvertBack(object value, Type targetType, object parameter, string language) { if (value is string) { return(BadgeValue.Parse(value as string)); } return(BadgeValue.Parse(null)); }
/// <summary> /// Applies a change to the badge's glyph or number. /// </summary> /// <param name="badgeNotification"></param> public void Update(BadgeNotification badgeNotification) { if (badgeNotification.Content == null) { throw new NullReferenceException("badgeNotification.Content must be provided."); } IXmlNode badgeNode = badgeNotification.Content.SelectSingleNode("/badge"); if (badgeNode == null) { throw new NullReferenceException("<badge> element must be provided in the xml"); } var valueAttribute = badgeNode.Attributes.GetNamedItem("value"); if (valueAttribute == null) { throw new NullReferenceException("<badge> element must have a \"value\" attribute specified."); } _previewTile.SetBadge(BadgeValue.Parse(valueAttribute.InnerText)); }