Kaynağa Gözat

Added silent option for windows

Sebastián Katzer 8 yıl önce
ebeveyn
işleme
9b0f037ffb

+ 1 - 0
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Builder.cs

@@ -157,6 +157,7 @@ namespace LocalNotificationProxy.LocalNotification
 
             notification.Id = this.Content.Id;
             notification.Tag = this.Options.Id.ToString();
+            notification.SuppressPopup = this.Options.Silent;
 
             if (this.Trigger.Occurrence > 1)
             {

+ 15 - 0
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Options.cs

@@ -60,6 +60,11 @@ namespace LocalNotificationProxy.LocalNotification
         /// </summary>
         public string Image { get; set; }
 
+        /// <summary>
+        /// Gets or sets a value indicating whether the popup shall be visible.
+        /// </summary>
+        public bool Silent { get; set; } = false;
+
         /// <summary>
         /// Gets or sets the notification trigger.
         /// </summary>
@@ -126,6 +131,11 @@ namespace LocalNotificationProxy.LocalNotification
                 options.Attachments = node.GetAttribute("attachments").Split(',');
             }
 
+            if (node.GetAttributeNode("silent") != null)
+            {
+                options.Silent = true;
+            }
+
             if (node.GetAttributeNode("action") != null)
             {
                 options.Action = node.GetAttribute("action");
@@ -185,6 +195,11 @@ namespace LocalNotificationProxy.LocalNotification
                 node.SetAttribute("attachments", string.Join(",", this.Attachments));
             }
 
+            if (this.Silent)
+            {
+                node.SetAttribute("silent", "1");
+            }
+
             if (action != null)
             {
                 node.SetAttribute("action", action);