Przeglądaj źródła

Support for new trigger option in: (Windows)

Sebastián Katzer 8 lat temu
rodzic
commit
cbdcee1b24

+ 10 - 2
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Notification.cs

@@ -293,9 +293,17 @@
             get
             {
                 var trigger = this.Options.Trigger;
-                var time = trigger.At;
-                var date = DateTimeOffset.FromUnixTimeMilliseconds(time * 1000).LocalDateTime;
                 var minDate = DateTime.Now.AddSeconds(0.1);
+                DateTime date;
+
+                if (trigger.In != 0)
+                {
+                    date = DateTime.Now.AddSeconds(trigger.In);
+                }
+                else
+                {
+                    date = DateTimeOffset.FromUnixTimeMilliseconds(trigger.At * 1000).LocalDateTime;
+                }
 
                 date = date.AddTicks(this.Interval.Ticks * (trigger.Occurrence - 1));
 

+ 6 - 1
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Trigger.cs

@@ -31,7 +31,12 @@ namespace LocalNotificationProxy.LocalNotification
         /// <summary>
         /// Gets or sets trigger date.
         /// </summary>
-        public long At { get; set; }
+        public long At { get; set; } = 0;
+
+        /// <summary>
+        /// Gets or sets relative trigger date in seconds from now.
+        /// </summary>
+        public long In { get; set; } = 0;
 
         /// <summary>
         /// Gets or sets trigger count.