mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 05:05:05 +00:00
feat: Added session change event to IcdEnvironment
This commit is contained in:
@@ -130,6 +130,29 @@ namespace ICD.Common.Utils
|
|||||||
const string replace = "$1:$2:$3:$4:$5:$6";
|
const string replace = "$1:$2:$3:$4:$5:$6";
|
||||||
return Regex.Replace(address, regex, replace);
|
return Regex.Replace(address, regex, replace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called by the application to raise the program status.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status"></param>
|
||||||
|
public static void SetProgramStatus(eProgramStatusEventType status)
|
||||||
|
{
|
||||||
|
ProgramStatusCallback handler = OnProgramStatusEvent;
|
||||||
|
if (handler != null)
|
||||||
|
handler(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called by the application to raise session change events.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sessionId"></param>
|
||||||
|
/// <param name="reasonCode"></param>
|
||||||
|
public static void HandleSessionChange(int sessionId, eSessionChangeEventType reasonCode)
|
||||||
|
{
|
||||||
|
SessionChangeEventCallback handler = OnSessionChangedEvent;
|
||||||
|
if (handler != null)
|
||||||
|
handler(sessionId, reasonCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -68,14 +68,44 @@ namespace ICD.Common.Utils
|
|||||||
EthernetLan2Adapter = 8,
|
EthernetLan2Adapter = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum for session change events.
|
||||||
|
/// </summary>
|
||||||
|
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 ProgramStatusCallback(eProgramStatusEventType type);
|
||||||
|
|
||||||
public delegate void EthernetEventCallback(eEthernetAdapterType adapter, eEthernetEventType type);
|
public delegate void EthernetEventCallback(eEthernetAdapterType adapter, eEthernetEventType type);
|
||||||
|
|
||||||
|
public delegate void SessionChangeEventCallback(int sessionId, eSessionChangeEventType type);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when the program status changes.
|
||||||
|
/// </summary>
|
||||||
public static event ProgramStatusCallback OnProgramStatusEvent;
|
public static event ProgramStatusCallback OnProgramStatusEvent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when a network adapter connects/disconnects.
|
||||||
|
/// </summary>
|
||||||
public static event EthernetEventCallback OnEthernetEvent;
|
public static event EthernetEventCallback OnEthernetEvent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when a session changes, such as user logging in/out.
|
||||||
|
/// </summary>
|
||||||
|
public static event SessionChangeEventCallback OnSessionChangedEvent;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised when the program has completed initialization.
|
/// Raised when the program has completed initialization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -86,11 +116,9 @@ namespace ICD.Common.Utils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static event EventHandler OnSystemDateTimeChanged;
|
public static event EventHandler OnSystemDateTimeChanged;
|
||||||
|
|
||||||
private static eFramework s_Framework;
|
private static readonly eFramework s_Framework;
|
||||||
|
private static readonly eCrestronSeries s_CrestronSeries;
|
||||||
private static eCrestronSeries s_CrestronSeries;
|
private static readonly eCrestronRuntimeEnvironment s_CrestronRuntimeEnvironment;
|
||||||
|
|
||||||
private static eCrestronRuntimeEnvironment s_CrestronRuntimeEnvironment;
|
|
||||||
|
|
||||||
private static readonly SafeCriticalSection s_ProgramInitializationSection = new SafeCriticalSection();
|
private static readonly SafeCriticalSection s_ProgramInitializationSection = new SafeCriticalSection();
|
||||||
private static bool s_ProgramInitializationComplete;
|
private static bool s_ProgramInitializationComplete;
|
||||||
@@ -128,12 +156,12 @@ namespace ICD.Common.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets UTC time
|
/// Gets UTC time.
|
||||||
/// Uses GetLocalTime so Crestron Env will have ms percision
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static DateTime GetUtcTime()
|
public static DateTime GetUtcTime()
|
||||||
{
|
{
|
||||||
|
// Use GetLocalTime so Crestron Env will have ms precision
|
||||||
return GetLocalTime().ToUniversalTime();
|
return GetLocalTime().ToUniversalTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user