Microsoft.Win32.SystemEvents 9.0.0-rc.1.24431.7

Prefix Reserved
This is a prerelease version of Microsoft.Win32.SystemEvents.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Microsoft.Win32.SystemEvents --version 9.0.0-rc.1.24431.7                
NuGet\Install-Package Microsoft.Win32.SystemEvents -Version 9.0.0-rc.1.24431.7                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="9.0.0-rc.1.24431.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.Win32.SystemEvents --version 9.0.0-rc.1.24431.7                
#r "nuget: Microsoft.Win32.SystemEvents, 9.0.0-rc.1.24431.7"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.Win32.SystemEvents as a Cake Addin
#addin nuget:?package=Microsoft.Win32.SystemEvents&version=9.0.0-rc.1.24431.7&prerelease

// Install Microsoft.Win32.SystemEvents as a Cake Tool
#tool nuget:?package=Microsoft.Win32.SystemEvents&version=9.0.0-rc.1.24431.7&prerelease                

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.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (40)

Showing the top 5 NuGet packages that depend on Microsoft.Win32.SystemEvents:

Package Downloads
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.

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.

TopShelf.ServiceInstaller

Topshelf is an open source project for hosting services without friction. By referencing Topshelf, your console application *becomes* a service installer with a comprehensive set of command-line options for installing, configuring, and running your application as a service.

Uno.WinUI.Runtime.Skia.Gtk

This package provides the platform support for Skia in Uno Platform projects.

Uno.UI.Runtime.Skia.Gtk

This package provides the platform support for Skia in Uno Platform projects.

GitHub repositories (15)

Showing the top 5 popular GitHub repositories that depend on Microsoft.Win32.SystemEvents:

Repository Stars
microsoft/PowerToys
Windows system utilities to maximize productivity
BeyondDimension/SteamTools
🛠「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。
duplicati/duplicati
Store securely encrypted backups in the cloud!
unoplatform/uno
Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
BartoszCichecki/LenovoLegionToolkit
Lightweight Lenovo Vantage and Hotkeys replacement for Lenovo Legion laptops.
Version Downloads Last updated
9.0.0-rc.2.24473.5 2,816 10/8/2024
9.0.0-rc.1.24431.7 13,948 9/10/2024
9.0.0-preview.7.24405.7 10,155 8/13/2024
9.0.0-preview.6.24327.7 18,081 7/9/2024
9.0.0-preview.5.24306.7 11,780 6/11/2024
9.0.0-preview.4.24266.19 6,436 5/21/2024
9.0.0-preview.3.24172.9 15,508 4/11/2024
9.0.0-preview.2.24128.5 5,712 3/12/2024
9.0.0-preview.1.24080.9 16,131 2/13/2024
8.0.0 18,065,038 11/14/2023
8.0.0-rc.2.23479.6 62,037 10/10/2023
8.0.0-rc.1.23419.4 21,197 9/12/2023
8.0.0-preview.7.23375.6 74,220 8/8/2023
8.0.0-preview.6.23329.7 1,154 7/11/2023
8.0.0-preview.5.23280.8 39,587 6/13/2023
8.0.0-preview.4.23259.5 12,851 5/16/2023
8.0.0-preview.3.23174.8 19,705 4/11/2023
8.0.0-preview.2.23128.3 87,320 3/14/2023
8.0.0-preview.1.23110.8 67,315 2/21/2023
7.0.0 78,198,045 11/7/2022
7.0.0-rc.2.22472.3 162,061 10/11/2022
7.0.0-rc.1.22426.10 148,451 9/14/2022
7.0.0-preview.7.22375.6 52,846 8/9/2022
7.0.0-preview.6.22324.4 66,424 7/12/2022
7.0.0-preview.5.22301.12 40,814 6/14/2022
7.0.0-preview.4.22229.4 35,243 5/10/2022
7.0.0-preview.3.22175.4 75,559 4/13/2022
7.0.0-preview.2.22152.2 40,033 3/14/2022
7.0.0-preview.1.22076.8 30,802 2/17/2022
6.0.1 3,517,377 4/12/2022
6.0.0 289,888,540 11/8/2021
6.0.0-rc.2.21480.5 78,723 10/12/2021
6.0.0-rc.1.21451.13 83,772 9/14/2021
6.0.0-preview.7.21377.19 659,858 8/10/2021
6.0.0-preview.6.21352.12 83,762 7/14/2021
6.0.0-preview.5.21301.5 79,535 6/15/2021
6.0.0-preview.4.21253.7 70,677 5/24/2021
6.0.0-preview.3.21201.4 191,215 4/8/2021
6.0.0-preview.2.21154.6 86,885 3/11/2021
6.0.0-preview.1.21102.12 162,370 2/12/2021
5.0.0 349,301,129 11/9/2020 5.0.0 is deprecated because it is no longer maintained.
5.0.0-rc.2.20475.5 133,646 10/13/2020
5.0.0-rc.1.20451.14 120,645 9/14/2020
5.0.0-preview.8.20407.11 181,090 8/25/2020
5.0.0-preview.7.20364.11 135,096 7/21/2020
5.0.0-preview.6.20305.6 111,230 6/25/2020
5.0.0-preview.5.20278.1 36,195 6/10/2020
5.0.0-preview.4.20251.6 137,785 5/18/2020
5.0.0-preview.3.20214.6 74,979 4/23/2020
5.0.0-preview.2.20160.6 81,129 4/2/2020
5.0.0-preview.1.20120.5 48,994 3/16/2020
4.7.0 547,939,956 12/3/2019
4.7.0-preview3.19551.4 51,637 11/13/2019
4.7.0-preview2.19523.17 26,125 11/1/2019
4.7.0-preview1.19504.10 31,834 10/15/2019
4.6.0 60,006,089 9/23/2019
4.6.0-rc1.19456.4 77,190 9/16/2019
4.6.0-preview9.19421.4 28,140 9/4/2019
4.6.0-preview9.19416.11 784 9/4/2019
4.6.0-preview8.19405.3 272,863 8/13/2019
4.6.0-preview7.19362.9 67,235 7/23/2019
4.6.0-preview6.19303.8 11,898,966 6/12/2019
4.6.0-preview6.19264.9 688 9/4/2019
4.6.0-preview5.19224.8 124,894 5/6/2019
4.6.0-preview4.19212.13 20,948 4/18/2019
4.6.0-preview3.19128.7 294,040 3/6/2019
4.6.0-preview.19073.11 45,971 1/29/2019
4.6.0-preview.18571.3 96,245 12/3/2018
4.5.0 125,124,236 5/29/2018
4.5.0-rc1 148,057 5/6/2018
4.5.0-preview2-26406-04 714,663 4/10/2018