Add program init complete logic

This commit is contained in:
Andrew Welker
2020-07-08 11:38:09 -06:00
parent 2a1ff2e32b
commit b1befeb32d

View File

@@ -35,6 +35,7 @@ namespace PepperDash.Essentials
Thread.MaxNumberOfUserThreads = 400; Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this; Global.ControlSystem = this;
DeviceManager.Initialize(this); DeviceManager.Initialize(this);
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
} }
/// <summary> /// <summary>
@@ -90,7 +91,12 @@ namespace PepperDash.Essentials
if (!Debug.DoNotLoadOnNextBoot) if (!Debug.DoNotLoadOnNextBoot)
{
GoWithLoad(); GoWithLoad();
return;
}
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
} }
/// <summary> /// <summary>
@@ -188,11 +194,14 @@ namespace PepperDash.Essentials
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config..."); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config...");
if (!ConfigReader.LoadConfig2()) if (!ConfigReader.LoadConfig2())
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Essentials Load complete with errors");
return; return;
}
Load(); Load();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r\n" +
"-------------------------------------------------------------"); "-------------------------------------------------------------");
} }
else else
{ {
@@ -211,11 +220,13 @@ namespace PepperDash.Essentials
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e); Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r\n{0}", e);
}
finally
{
// Notify the OS that the program intitialization has completed
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
} }
// Notify the OS that the program intitialization has completed
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
} }