Skip to content

Commit

Permalink
COnvert AlarmAction from enum to class #318
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian Stockbower committed Nov 9, 2017
1 parent 7c1c3ac commit edee657
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions net-core/Ical.Net/Ical.Net/Components/Alarm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace Ical.Net
/// </summary>
public class Alarm : CalendarComponent
{
public virtual AlarmAction Action
public virtual string Action
{
get => Properties.Get<AlarmAction>("ACTION");
set => Properties.Set("ACTION", value);
get => Properties.Get<string>(AlarmAction.Key);
set => Properties.Set(AlarmAction.Key, value);
}

public virtual Attachment Attachment
Expand Down
16 changes: 11 additions & 5 deletions net-core/Ical.Net/Ical.Net/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

namespace Ical.Net
{
public enum AlarmAction
public static class AlarmAction
{
Audio,
Display,
Email,
Procedure
public const string Name = "ACTION";
public const string Key = "ACTION";
public static readonly StringComparison Comparison = StringComparison.Ordinal;

public const string Audio = "AUDIO";
public const string Display = "DISPLAY";
public const string Email = "EMAIL";

[Obsolete("Procedure was deprecated by RFC-5545")]
public const string Procedure = "PROCEDURE";
}

public enum TriggerRelation
Expand Down
2 changes: 1 addition & 1 deletion net-core/Ical.Net/Ical.Net/Serialization/DataTypeMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private class PropertyMapping

public DataTypeMapper()
{
AddPropertyMapping("ACTION", typeof (AlarmAction), false);
AddPropertyMapping(AlarmAction.Name, typeof (AlarmAction), false);
AddPropertyMapping("ATTACH", typeof (Attachment), false);
AddPropertyMapping("ATTENDEE", typeof (Attendee), false);
AddPropertyMapping("CATEGORIES", typeof (string), true);
Expand Down

0 comments on commit edee657

Please sign in to comment.