mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 11:04:21 +01:00
parent
a4936eb5a0
commit
b6b57ed7ca
@ -257,9 +257,11 @@ Properties.Resources.DS4Update, MessageBoxButton.YesNo, MessageBoxImage.Question
|
|||||||
autoProfileHolder.AutoProfileColl.CollectionChanged += AutoProfileColl_CollectionChanged;
|
autoProfileHolder.AutoProfileColl.CollectionChanged += AutoProfileColl_CollectionChanged;
|
||||||
//autoProfControl.AutoProfVM.AutoProfileSystemChange += AutoProfVM_AutoProfileSystemChange;
|
//autoProfControl.AutoProfVM.AutoProfileSystemChange += AutoProfVM_AutoProfileSystemChange;
|
||||||
|
|
||||||
|
bool wmiConnected = false;
|
||||||
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
|
try
|
||||||
{
|
{
|
||||||
scope.Connect();
|
scope.Connect();
|
||||||
@ -268,13 +270,20 @@ Properties.Resources.DS4Update, MessageBoxButton.YesNo, MessageBoxImage.Question
|
|||||||
|
|
||||||
if (scope.IsConnected)
|
if (scope.IsConnected)
|
||||||
{
|
{
|
||||||
|
wmiConnected = true;
|
||||||
managementEvWatcher = new ManagementEventWatcher(scope, q);
|
managementEvWatcher = new ManagementEventWatcher(scope, q);
|
||||||
managementEvWatcher.EventArrived += PowerEventArrive;
|
managementEvWatcher.EventArrived += PowerEventArrive;
|
||||||
|
try
|
||||||
|
{
|
||||||
managementEvWatcher.Start();
|
managementEvWatcher.Start();
|
||||||
}
|
}
|
||||||
else
|
catch (ManagementException) { wmiConnected = false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wmiConnected)
|
||||||
{
|
{
|
||||||
AppLogger.LogToGui("Could not connect to Windows Management Instrumentation service. Suspend support not enabled.", true);
|
AppLogger.LogToGui(@"Could not connect to Windows Management Instrumentation service.
|
||||||
|
Suspend support not enabled.", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user