Microsoft.Win32.SystemEvents 9.0.0

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.
65
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.
77
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.
87
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.
90
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.
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.
78
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.
78
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.
65
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.
69
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.
71
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.
72
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.
81
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.
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 Core as well as .NET Standard. When using NuGet 3.x this package requires at least version 3.4.
89
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 Since .NET 7, non-Windows platforms are not supported, even with the runtime configuration switch. See https://aka.ms/systemdrawingnonwindows for more information.
61
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.
377
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,802
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,324

https://go.microsoft.com/fwlink/?LinkID=799421

.NET Framework 4.6.2

  • No dependencies.

.NET 8.0

  • No dependencies.

.NET 9.0

  • No dependencies.

.NET Standard 2.0

  • No dependencies.

Version Downloads Last updated
9.0.0 6 11/14/2024
9.0.0-rc.2.24473.5 12 10/12/2024
9.0.0-rc.1.24431.7 13 09/20/2024
9.0.0-preview.7.24405.7 15 08/14/2024
9.0.0-preview.6.24327.7 9 07/22/2024
9.0.0-preview.5.24306.7 11 06/20/2024
9.0.0-preview.4.24266.19 9 05/24/2024
9.0.0-preview.3.24172.9 12 05/21/2024
9.0.0-preview.2.24128.5 10 03/16/2024
9.0.0-preview.1.24080.9 17 03/11/2024
8.0.0 17 11/20/2023
8.0.0-rc.2.23479.6 14 10/20/2023
8.0.0-rc.1.23419.4 14 09/23/2023
8.0.0-preview.7.23375.6 22 09/11/2023
8.0.0-preview.6.23329.7 15 08/14/2023
8.0.0-preview.5.23280.8 19 06/23/2023
8.0.0-preview.4.23259.5 14 06/23/2023
8.0.0-preview.3.23174.8 19 06/23/2023
8.0.0-preview.2.23128.3 20 04/04/2023
8.0.0-preview.1.23110.8 21 04/04/2023
7.0.0 32 12/09/2022
7.0.0-rc.2.22472.3 22 10/15/2022
7.0.0-rc.1.22426.10 63 09/23/2022
7.0.0-preview.7.22375.6 46 08/20/2022
7.0.0-preview.6.22324.4 19 09/24/2022
7.0.0-preview.5.22301.12 30 09/23/2022
7.0.0-preview.4.22229.4 25 09/21/2022
7.0.0-preview.3.22175.4 36 09/22/2022
7.0.0-preview.2.22152.2 33 09/22/2022
7.0.0-preview.1.22076.8 39 07/07/2022
6.0.2-mauipre.1.22102.15 19 09/24/2022
6.0.2-mauipre.1.22054.8 26 09/22/2022
6.0.1 26 09/23/2022
6.0.0 30 09/24/2022
6.0.0-rc.2.21480.5 40 09/22/2022
6.0.0-rc.1.21451.13 36 09/26/2022
6.0.0-preview.7.21377.19 31 09/21/2022
6.0.0-preview.6.21352.12 28 09/21/2022
6.0.0-preview.5.21301.5 44 09/21/2022
6.0.0-preview.4.21253.7 14 09/22/2022
6.0.0-preview.3.21201.4 25 09/23/2022
6.0.0-preview.2.21154.6 31 09/22/2022
6.0.0-preview.1.21102.12 57 09/23/2022
5.0.0 2,267 09/21/2022
5.0.0-rc.2.20475.5 35 09/22/2022
5.0.0-rc.1.20451.14 33 09/26/2022
5.0.0-preview.8.20407.11 19 09/21/2022
5.0.0-preview.7.20364.11 72 10/15/2022
5.0.0-preview.6.20305.6 39 09/25/2022
5.0.0-preview.5.20278.1 24 09/22/2022
5.0.0-preview.4.20251.6 78 09/21/2022
5.0.0-preview.3.20214.6 44 09/23/2022
5.0.0-preview.2.20160.6 16 09/22/2022
5.0.0-preview.1.20120.5 36 09/21/2022
4.7.0 23,305 06/27/2022
4.7.0-preview3.19551.4 26 09/24/2022
4.7.0-preview2.19523.17 27 10/15/2022
4.7.0-preview1.19504.10 44 09/22/2022
4.6.0 54 10/15/2022
4.6.0-rc1.19456.4 20 09/23/2022
4.6.0-preview9.19421.4 82 09/22/2022
4.6.0-preview9.19416.11 39 09/22/2022
4.6.0-preview8.19405.3 28 09/21/2022
4.6.0-preview7.19362.9 28 09/23/2022
4.6.0-preview6.19303.8 41 10/15/2022
4.6.0-preview6.19264.9 84 10/15/2022
4.6.0-preview5.19224.8 32 09/23/2022
4.6.0-preview4.19212.13 20 09/22/2022
4.6.0-preview3.19128.7 36 09/22/2022
4.6.0-preview.19073.11 46 09/23/2022
4.6.0-preview.18571.3 74 09/21/2022
4.5.0 44 06/27/2022
4.5.0-rc1 22 09/21/2022
4.5.0-preview2-26406-04 23 09/22/2022