Siticone Global Event Handler
The SiticoneGlobalEventHandler is a powerful non-visual component that centralizes monitoring for application-wide and system-level events.
Instead of writing complex hooks or scattered event listeners, use this component to detect idle states, network connectivity changes, system power modes, and unhandled exceptions from a single location.
Feature Configuration
Enable or disable specific monitoring capabilities to optimize performance.
| Property | Type | Description & Usage Example |
|---|---|---|
EnableIdleDetection |
bool | monitor.EnableIdleDetection = true; Enables the ApplicationIdle event, firing when the user is inactive. |
IdleThreshold |
TimeSpan | monitor.IdleThreshold = TimeSpan.FromMinutes(5); The duration of inactivity required before triggering the idle event. |
EnableNetworkMonitoring |
bool | monitor.EnableNetworkMonitoring = true; Tracks network availability changes. |
EnableClipboardMonitoring |
bool | monitor.EnableClipboardMonitoring = true; Polls the system clipboard for text changes. |
EnableExceptionHandling |
bool | monitor.EnableExceptionHandling = true; Catches global unhandled exceptions for centralized logging. |
Status Properties
Read-only properties providing real-time status information.
| Property | Type | Description |
|---|---|---|
IsNetworkAvailable |
bool | Returns true if any network connection is currently active. |
IsApplicationFocused |
bool | Returns true if the application is currently the active foreground window. |
System Events
// Fires when network connects or disconnects
globalMonitor.NetworkAvailabilityChanged += (s, e) =>
{
if (e.IsAvailable)
Console.WriteLine("Network Connected");
else
Console.WriteLine("Network Lost!");
};
// Fires when the application has been idle for longer than IdleThreshold
globalMonitor.ApplicationIdle += (s, e) =>
{
// Example: Auto-lock the application
LockScreen();
};
// Fires when the system clipboard content changes (text only)
globalMonitor.ClipboardChanged += (s, e) =>
{
string text = Clipboard.GetText();
Console.WriteLine($"New clipboard content: {text}");
};
// Centralized error catching for UI and non-UI threads
globalMonitor.UnhandledExceptionCaught += (s, e) =>
{
Logger.LogError(e.ExceptionObject);
if (e.IsUiException)
MessageBox.Show("A critical UI error occurred.");
};
Designer Support
Includes a Smart Tag panel for quick configuration of monitoring features.
| Category | Features |
|---|---|
Feature Toggles |
Enable/Disable individual monitors: Idle, Network, System, Focus, Exceptions, Clipboard, Application Exit. |
Detailed Usage Examples
Example 1: Auto-Lock Security System
Locks the application when the user is inactive or the session is locked.
private void InitializeSecurityMonitor()
{
globalEvents.IdleThreshold = TimeSpan.FromMinutes(15);
globalEvents.EnableIdleDetection = true;
globalEvents.EnableSystemEvents = true;
// Handle Inactivity
globalEvents.ApplicationIdle += (s, e) => LockApplication();
// Handle Windows Lock/Switch User
globalEvents.SessionSwitch += (s, e) =>
{
if (e.Reason == SessionSwitchReason.SessionLock)
LockApplication();
};
}
Example 2: Smart Power Management
Reduces application resource usage when the system switches to battery power.
private void SetupPowerMonitor()
{
globalEvents.PowerModeChanged += (s, e) =>
{
if (e.Mode == PowerModes.StatusChange)
{
// Check system power status
if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Offline)
{
// Switch to low power mode
DisableAnimations();
ReduceRefreshRate();
}
else
{
// Restore performance
EnableAnimations();
}
}
};
}