mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 11:04:21 +01:00
parent
b98ef8afdb
commit
e7068b870a
@ -156,9 +156,23 @@ namespace DS4Windows.Forms
|
|||||||
WqlEventQuery q = new WqlEventQuery();
|
WqlEventQuery q = new WqlEventQuery();
|
||||||
ManagementScope scope = new ManagementScope("root\\CIMV2");
|
ManagementScope scope = new ManagementScope("root\\CIMV2");
|
||||||
q.EventClassName = "Win32_PowerManagementEvent";
|
q.EventClassName = "Win32_PowerManagementEvent";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
scope.Connect();
|
||||||
|
}
|
||||||
|
catch (COMException) { }
|
||||||
|
|
||||||
|
if (scope.IsConnected)
|
||||||
|
{
|
||||||
managementEvWatcher = new ManagementEventWatcher(scope, q);
|
managementEvWatcher = new ManagementEventWatcher(scope, q);
|
||||||
managementEvWatcher.EventArrived += PowerEventArrive;
|
managementEvWatcher.EventArrived += PowerEventArrive;
|
||||||
managementEvWatcher.Start();
|
managementEvWatcher.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogDebug(DateTime.Now,
|
||||||
|
"Could not connect to Windows Management Instrumentation service. Suspend support not enabled.", true);
|
||||||
|
}
|
||||||
|
|
||||||
tSOptions.Visible = false;
|
tSOptions.Visible = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user