diff --git a/src/Pepperdash Core/CoreInterfaces.cs b/src/Pepperdash Core/CoreInterfaces.cs index c1432c2..6e0b639 100644 --- a/src/Pepperdash Core/CoreInterfaces.cs +++ b/src/Pepperdash Core/CoreInterfaces.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; +using Newtonsoft.Json; using Serilog; namespace PepperDash.Core @@ -15,6 +16,7 @@ namespace PepperDash.Core /// /// Unique Key /// + [JsonProperty("key")] string Key { get; } } @@ -26,6 +28,7 @@ namespace PepperDash.Core /// /// Isn't it obvious :) /// + [JsonProperty("name")] string Name { get; } } diff --git a/src/Pepperdash Core/Device.cs b/src/Pepperdash Core/Device.cs index 749713e..fda30c4 100644 --- a/src/Pepperdash Core/Device.cs +++ b/src/Pepperdash Core/Device.cs @@ -99,7 +99,15 @@ namespace PepperDash.Core public void PreActivate() { if (_PreActivationActions != null) - _PreActivationActions.ForEach(a => a.Invoke()); + _PreActivationActions.ForEach(a => { + try + { + a.Invoke(); + } catch (Exception e) + { + Debug.LogMessage(e, "Error in PreActivationAction: " + e.Message, this); + } + }); } /// @@ -123,7 +131,16 @@ namespace PepperDash.Core public void PostActivate() { if (_PostActivationActions != null) - _PostActivationActions.ForEach(a => a.Invoke()); + _PostActivationActions.ForEach(a => { + try + { + a.Invoke(); + } + catch (Exception e) + { + Debug.LogMessage(e, "Error in PostActivationAction: " + e.Message, this); + } + }); } ///