Microsoft.Win32.SystemEvents 9.0.0-rc.2.24473.5
About
Provides support for accessing Windows system event notifications, which can be crucial for applications to respond to changes in the system or user environment​.
Through this assembly, applications can subscribe to a set of global system events provided by the SystemEvents
class, gaining the ability to react to changes like system power mode alterations, user preference modifications, and session switches, among others.
Key Features
- Access to a set of global system events
- Notification of changes in user preferences
- Notification of system power mode changes
- Notification of session switches
How to Use
An example of how to use the SystemEvents
class to react to system changes:
using Microsoft.Win32;
// Set the SystemEvents class to receive event notification when a user
// preference changes, the palette changes, or when display settings change.
SystemEvents.UserPreferenceChanging += UserPreferenceChanging;
SystemEvents.PaletteChanged += PaletteChanged;
SystemEvents.DisplaySettingsChanged += DisplaySettingsChanged;
// For demonstration purposes, this application sits idle waiting for events.
Console.WriteLine("This application is waiting for system events.");
Console.WriteLine("Press <Enter> to terminate this application.");
Console.ReadLine();
// This method is called when a user preference changes.
static void UserPreferenceChanging(object sender, UserPreferenceChangingEventArgs e)
{
Console.WriteLine($"The user preference is changing. Category={e.Category}");
}
// This method is called when the palette changes.
static void PaletteChanged(object sender, EventArgs e)
{
Console.WriteLine("The palette changed.");
}
// This method is called when the display settings change.
static void DisplaySettingsChanged(object sender, EventArgs e)
{
Console.WriteLine("The display settings changed.");
}
In this example, the methods will be invoked whenever the user modifies one of several system settings.
Main Types
The main types provided by this library are:
Microsoft.Win32.SystemEvents
Microsoft.Win32.PowerModeChangedEventHandler
Microsoft.Win32.SessionEndedEventHandler
Microsoft.Win32.UserPreferenceChangedEventHandler
Additional Documentation
Feedback & Contributing
Microsoft.Win32.SystemEvents is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on Microsoft.Win32.SystemEvents.
Packages | Downloads |
---|---|
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.
|
61 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.
|
75 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.
|
83 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.
|
85 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
|
62 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
|
74 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
8f968b9e79c5721d78cc88e46fe57457fe9d490d
When using NuGet 3.x this package requires at least version 3.4.
|
74 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
63 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
64 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
66 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
70 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
75 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
76 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
79 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
85 |
System.Drawing.Common
Provides access to GDI+ graphics functionality.
Commonly Used Types:
System.Drawing.Bitmap
System.Drawing.BitmapData
System.Drawing.Brush
System.Drawing.Font
System.Drawing.Graphics
System.Drawing.Icon
|
58 |
System.Drawing.Common
Provides access to GDI+ graphics functionality.
Commonly Used Types:
System.Drawing.Bitmap
System.Drawing.BitmapData
System.Drawing.Brush
System.Drawing.Font
System.Drawing.Graphics
System.Drawing.Icon
When using NuGet 3.x this package requires at least version 3.4.
|
366 |
System.Drawing.Common
Provides access to GDI+ graphics functionality.
Commonly Used Types:
System.Drawing.Bitmap
System.Drawing.BitmapData
System.Drawing.Brush
System.Drawing.Font
System.Drawing.Graphics
System.Drawing.Icon
When using NuGet 3.x this package requires at least version 3.4.
|
1,783 |
System.Drawing.Common
Provides access to GDI+ graphics functionality.
Commonly Used Types:
System.Drawing.Bitmap
System.Drawing.BitmapData
System.Drawing.Brush
System.Drawing.Font
System.Drawing.Graphics
System.Drawing.Icon
When using NuGet 3.x this package requires at least version 3.4.
|
23,123 |
.NET Framework 4.6.2
- No dependencies.
.NET 8.0
- No dependencies.
.NET 9.0
- No dependencies.
.NET Standard 2.0
- No dependencies.