Permalink
Browse files

Windows 8 minor fixes

  • Loading branch information...
1 parent 35b531d commit deae85c72151f0fecb0fd94867d32e9c8df9eefe @Redth committed Jan 29, 2013
Showing with 19 additions and 6 deletions.
  1. +2 −2 PushSharp.Windows/WindowsFluent.cs
  2. +17 −4 PushSharp.Windows/WindowsNotification.cs
View
4 PushSharp.Windows/WindowsFluent.cs
@@ -146,13 +146,13 @@ public static WindowsBadgeNumericNotification WithBadgeNumber(this WindowsBadgeN
public static WindowsToastNotification WithVersion(this WindowsToastNotification notification, int version = 1)
{
- notification.Version = version;
+ notification.Visual.Version = version;
return notification;
}
public static WindowsTileNotification WithVersion(this WindowsTileNotification notification, int version = 1)
{
- notification.Version = version;
+ notification.Visual.Version = version;
return notification;
}
View
21 PushSharp.Windows/WindowsNotification.cs
@@ -18,7 +18,6 @@ protected WindowsNotification()
public bool? RequestForStatus { get; set; }
public int? TimeToLive { get; set; }
- public int Version = 1;
public abstract string PayloadToString();
@@ -188,7 +187,7 @@ public XElement GenerateXmlElement()
var binding = new XElement("binding", new XAttribute("template", ToastTemplate.ToString()));
if (!string.IsNullOrEmpty(Fallback))
- binding.Add(new XAttribute("lang", XmlEncode(Fallback)));
+ binding.Add(new XAttribute("fallback", XmlEncode(Fallback)));
if (!string.IsNullOrEmpty(Language))
binding.Add(new XAttribute("lang", XmlEncode(Language)));
@@ -370,11 +369,15 @@ public override WindowsNotificationType Type
public WindowsNotificationCachePolicyType? CachePolicy { get; set; }
public BadgeGlyphValue Glyph { get; set; }
+ public int? Version { get; set; }
public override string PayloadToString()
{
var badge = new XElement("badge");
- badge.Add(new XAttribute("version", this.Version));
+
+ if (Version.HasValue)
+ badge.Add(new XAttribute("version", this.Version.Value.ToString()));
+
badge.Add(new XAttribute("value", Glyph.ToString().ToLowerInvariant()));
return badge.ToString();
@@ -391,11 +394,15 @@ public override WindowsNotificationType Type
public WindowsNotificationCachePolicyType? CachePolicy { get; set; }
public int BadgeNumber { get; set; }
+ public int? Version { get; set; }
public override string PayloadToString()
{
var badge = new XElement("badge");
- badge.Add(new XAttribute("version", this.Version));
+
+ if (Version.HasValue)
+ badge.Add(new XAttribute("version", this.Version.Value));
+
badge.Add(new XAttribute("value", BadgeNumber.ToString().ToLowerInvariant()));
return badge.ToString();
@@ -466,6 +473,9 @@ public XElement GenerateXmlElement(int id)
if (!string.IsNullOrEmpty(Language))
text.Add(new XAttribute("lang", XmlEncode(Language)));
+ if (!string.IsNullOrEmpty(Text))
+ text.Add(XmlEncode(Text));
+
return text;
}
@@ -487,6 +497,9 @@ public XElement GenerateXmlElement(int id)
if (!string.IsNullOrEmpty(Language))
text.Add(new XAttribute("lang", XmlEncode(Language)));
+ if (!string.IsNullOrEmpty(Text))
+ text.Add(XmlEncode(Text));
+
return text;
}

0 comments on commit deae85c

Please sign in to comment.