diff --git a/ICD.Common.Utils/IcdEnvironment.Standard.cs b/ICD.Common.Utils/IcdEnvironment.Standard.cs
index d75e7cd..c1872aa 100644
--- a/ICD.Common.Utils/IcdEnvironment.Standard.cs
+++ b/ICD.Common.Utils/IcdEnvironment.Standard.cs
@@ -130,6 +130,29 @@ namespace ICD.Common.Utils
const string replace = "$1:$2:$3:$4:$5:$6";
return Regex.Replace(address, regex, replace);
}
+
+ ///
+ /// Called by the application to raise the program status.
+ ///
+ ///
+ public static void SetProgramStatus(eProgramStatusEventType status)
+ {
+ ProgramStatusCallback handler = OnProgramStatusEvent;
+ if (handler != null)
+ handler(status);
+ }
+
+ ///
+ /// Called by the application to raise session change events.
+ ///
+ ///
+ ///
+ public static void HandleSessionChange(int sessionId, eSessionChangeEventType reasonCode)
+ {
+ SessionChangeEventCallback handler = OnSessionChangedEvent;
+ if (handler != null)
+ handler(sessionId, reasonCode);
+ }
}
}
#endif
diff --git a/ICD.Common.Utils/IcdEnvironment.cs b/ICD.Common.Utils/IcdEnvironment.cs
index 0d78522..a37c0f2 100644
--- a/ICD.Common.Utils/IcdEnvironment.cs
+++ b/ICD.Common.Utils/IcdEnvironment.cs
@@ -68,14 +68,44 @@ namespace ICD.Common.Utils
EthernetLan2Adapter = 8,
}
+ ///
+ /// Enum for session change events.
+ ///
+ public enum eSessionChangeEventType
+ {
+ None = 0,
+ ConsoleConnect = 1,
+ ConsoleDisconnect = 2,
+ RemoteConnect = 3,
+ RemoteDisconnect = 4,
+ SessionLogon = 5,
+ SessionLogoff = 6,
+ SessionLock = 7,
+ SessionUnlock = 8,
+ SessionRemoteControl = 9
+ }
+
public delegate void ProgramStatusCallback(eProgramStatusEventType type);
public delegate void EthernetEventCallback(eEthernetAdapterType adapter, eEthernetEventType type);
+ public delegate void SessionChangeEventCallback(int sessionId, eSessionChangeEventType type);
+
+ ///
+ /// Raised when the program status changes.
+ ///
public static event ProgramStatusCallback OnProgramStatusEvent;
+ ///
+ /// Raised when a network adapter connects/disconnects.
+ ///
public static event EthernetEventCallback OnEthernetEvent;
+ ///
+ /// Raised when a session changes, such as user logging in/out.
+ ///
+ public static event SessionChangeEventCallback OnSessionChangedEvent;
+
///
/// Raised when the program has completed initialization.
///
@@ -86,11 +116,9 @@ namespace ICD.Common.Utils
///
public static event EventHandler OnSystemDateTimeChanged;
- private static eFramework s_Framework;
-
- private static eCrestronSeries s_CrestronSeries;
-
- private static eCrestronRuntimeEnvironment s_CrestronRuntimeEnvironment;
+ private static readonly eFramework s_Framework;
+ private static readonly eCrestronSeries s_CrestronSeries;
+ private static readonly eCrestronRuntimeEnvironment s_CrestronRuntimeEnvironment;
private static readonly SafeCriticalSection s_ProgramInitializationSection = new SafeCriticalSection();
private static bool s_ProgramInitializationComplete;
@@ -128,12 +156,12 @@ namespace ICD.Common.Utils
}
///
- /// Gets UTC time
- /// Uses GetLocalTime so Crestron Env will have ms percision
+ /// Gets UTC time.
///
///
public static DateTime GetUtcTime()
{
+ // Use GetLocalTime so Crestron Env will have ms precision
return GetLocalTime().ToUniversalTime();
}
}