Exposes DoNotStartOnNextBoot property on the Debug class properly.

This commit is contained in:
Neil Dorin
2019-11-15 13:06:37 -07:00
parent acf9514fc5
commit 7fdbf7c3a1
2 changed files with 18 additions and 10 deletions

View File

@@ -28,6 +28,8 @@ namespace PepperDash.Core
public static int Level { get; private set; } public static int Level { get; private set; }
public static bool DoNotStartOnNextBoot { get; private set; }
static DebugContextCollection Contexts; static DebugContextCollection Contexts;
static int SaveTimeoutMs = 30000; static int SaveTimeoutMs = 30000;
@@ -81,7 +83,10 @@ namespace PepperDash.Core
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler; CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
LoadMemory(); LoadMemory();
Level = Contexts.GetOrCreateItem("DEFAULT").Level;
var context = Contexts.GetOrCreateItem("DEFAULT");
Level = context.Level;
DoNotStartOnNextBoot = context.DoNotStartOnNextBoot;
try try
{ {
@@ -243,10 +248,12 @@ namespace PepperDash.Core
/// <param name="state"></param> /// <param name="state"></param>
public static void SetDoNotStartOnNextBoot(bool state) public static void SetDoNotStartOnNextBoot(bool state)
{ {
Contexts.DoNotStartOnNextBoot = state; DoNotStartOnNextBoot = state;
CrestronConsole.PrintLine("[Application {0}], Do Not Start on Next Boot set to {1}", Contexts.GetOrCreateItem("DEFAULT").DoNotStartOnNextBoot = state;
InitialParametersClass.ApplicationNumber, Contexts.DoNotStartOnNextBoot);
SaveMemoryOnTimeout(); SaveMemoryOnTimeout();
CrestronConsole.PrintLine("[Application {0}], Do Not Start on Next Boot set to {1}",
InitialParametersClass.ApplicationNumber, DoNotStartOnNextBoot);
} }
/// <summary> /// <summary>

View File

@@ -10,12 +10,6 @@ namespace PepperDash.Core.DebugThings
{ {
public class DebugContextCollection public class DebugContextCollection
{ {
/// <summary>
/// Property to tell the program not to intitialize when it boots, if desired
/// </summary>
[JsonProperty("doNotStartOnNextBoot")]
public bool DoNotStartOnNextBoot { get; set; }
[JsonProperty("items")] [JsonProperty("items")]
Dictionary<string, DebugContextItem> Items; Dictionary<string, DebugContextItem> Items;
@@ -59,6 +53,13 @@ namespace PepperDash.Core.DebugThings
[JsonProperty("level")] [JsonProperty("level")]
public int Level { get; set; } public int Level { get; set; }
/// <summary>
/// Property to tell the program not to intitialize when it boots, if desired
/// </summary>
[JsonProperty("doNotStartOnNextBoot")]
public bool DoNotStartOnNextBoot { get; set; }
public DebugContextItem(DebugContextCollection parent) public DebugContextItem(DebugContextCollection parent)
{ {