This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Management; | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
using (var watcher = new Win32PowerManagementEventWatcher()) | |
{ | |
watcher.Start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.InteropServices; | |
namespace ConsoleDemo | |
{ | |
internal static class NativeMethods | |
{ | |
// Doc MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/ms686016(v=vs.85).aspx | |
/// <summary> | |
/// <para>Adds or removes an <see cref="HandlerRoutine"/> delegate function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using System.Diagnostics; | |
using System.ComponentModel; | |
using System.Collections.Generic; | |
internal static class NativeMethods | |
{ | |
public static class NtDll |