From 739f3e383b758c6ac0c447545ce51cfc6e4d9b20 Mon Sep 17 00:00:00 2001 From: Aptivi CEO Date: Mon, 30 Sep 2024 19:47:13 +0300 Subject: [PATCH] add - Added duration/results for legacy alarms --- For legacy alarms, we've added two properties: - SnoozeDuration: a TimeSpan instance containing snooze duration - SnoozeIn: a DateTimeOffset instance containing a date/time to snooze --- Type: add Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- .../Parts/Implementations/Legacy/AudioAlarmInfo.cs | 12 ++++++++++++ .../Parts/Implementations/Legacy/DisplayAlarmInfo.cs | 12 ++++++++++++ .../Parts/Implementations/Legacy/MailAlarmInfo.cs | 12 ++++++++++++ .../Implementations/Legacy/ProcedureAlarmInfo.cs | 12 ++++++++++++ 4 files changed, 48 insertions(+) diff --git a/VisualCard.Calendar/Parts/Implementations/Legacy/AudioAlarmInfo.cs b/VisualCard.Calendar/Parts/Implementations/Legacy/AudioAlarmInfo.cs index 5ea38a9..5496141 100644 --- a/VisualCard.Calendar/Parts/Implementations/Legacy/AudioAlarmInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Legacy/AudioAlarmInfo.cs @@ -50,6 +50,18 @@ public class AudioAlarmInfo : BaseCalendarPartInfo, IEquatable /// public string? AudioResource { get; } + /// + /// Snooze duration. Throws exception if there is no snooze time, so check accordingly. + /// + public TimeSpan SnoozeDuration => + VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").span; + + /// + /// Snooze date/time. Throws exception if there is no snooze time, so check accordingly. + /// + public DateTimeOffset SnoozeIn => + VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result; + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, string[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => new AudioAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); diff --git a/VisualCard.Calendar/Parts/Implementations/Legacy/DisplayAlarmInfo.cs b/VisualCard.Calendar/Parts/Implementations/Legacy/DisplayAlarmInfo.cs index 3ed93cb..d7f8f0b 100644 --- a/VisualCard.Calendar/Parts/Implementations/Legacy/DisplayAlarmInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Legacy/DisplayAlarmInfo.cs @@ -50,6 +50,18 @@ public class DisplayAlarmInfo : BaseCalendarPartInfo, IEquatable public string? Display { get; } + /// + /// Snooze duration. Throws exception if there is no snooze time, so check accordingly. + /// + public TimeSpan SnoozeDuration => + VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").span; + + /// + /// Snooze date/time. Throws exception if there is no snooze time, so check accordingly. + /// + public DateTimeOffset SnoozeIn => + VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result; + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, string[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => new DisplayAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); diff --git a/VisualCard.Calendar/Parts/Implementations/Legacy/MailAlarmInfo.cs b/VisualCard.Calendar/Parts/Implementations/Legacy/MailAlarmInfo.cs index c18198a..c4aa7b0 100644 --- a/VisualCard.Calendar/Parts/Implementations/Legacy/MailAlarmInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Legacy/MailAlarmInfo.cs @@ -55,6 +55,18 @@ public class MailAlarmInfo : BaseCalendarPartInfo, IEquatable /// public string? Note { get; } + /// + /// Snooze duration. Throws exception if there is no snooze time, so check accordingly. + /// + public TimeSpan SnoozeDuration => + VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").span; + + /// + /// Snooze date/time. Throws exception if there is no snooze time, so check accordingly. + /// + public DateTimeOffset SnoozeIn => + VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result; + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, string[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => new MailAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion); diff --git a/VisualCard.Calendar/Parts/Implementations/Legacy/ProcedureAlarmInfo.cs b/VisualCard.Calendar/Parts/Implementations/Legacy/ProcedureAlarmInfo.cs index 18ab629..bac5b54 100644 --- a/VisualCard.Calendar/Parts/Implementations/Legacy/ProcedureAlarmInfo.cs +++ b/VisualCard.Calendar/Parts/Implementations/Legacy/ProcedureAlarmInfo.cs @@ -50,6 +50,18 @@ public class ProcedureAlarmInfo : BaseCalendarPartInfo, IEquatable public string? Procedure { get; } + /// + /// Snooze duration. Throws exception if there is no snooze time, so check accordingly. + /// + public TimeSpan SnoozeDuration => + VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").span; + + /// + /// Snooze date/time. Throws exception if there is no snooze time, so check accordingly. + /// + public DateTimeOffset SnoozeIn => + VcardCommonTools.GetDurationSpan(SnoozeTime ?? "").result; + internal static BaseCalendarPartInfo FromStringVcalendarStatic(string value, string[] finalArgs, string[] elementTypes, string valueType, Version calendarVersion) => new ProcedureAlarmInfo().FromStringVcalendarInternal(value, finalArgs, elementTypes, valueType, calendarVersion);