mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-22 09:19:18 +01:00
parent
a4936eb5a0
commit
b6b57ed7ca
@ -257,9 +257,11 @@ Properties.Resources.DS4Update, MessageBoxButton.YesNo, MessageBoxImage.Question
|
||||
autoProfileHolder.AutoProfileColl.CollectionChanged += AutoProfileColl_CollectionChanged;
|
||||
//autoProfControl.AutoProfVM.AutoProfileSystemChange += AutoProfVM_AutoProfileSystemChange;
|
||||
|
||||
bool wmiConnected = false;
|
||||
WqlEventQuery q = new WqlEventQuery();
|
||||
ManagementScope scope = new ManagementScope("root\\CIMV2");
|
||||
q.EventClassName = "Win32_PowerManagementEvent";
|
||||
|
||||
try
|
||||
{
|
||||
scope.Connect();
|
||||
@ -268,13 +270,20 @@ Properties.Resources.DS4Update, MessageBoxButton.YesNo, MessageBoxImage.Question
|
||||
|
||||
if (scope.IsConnected)
|
||||
{
|
||||
wmiConnected = true;
|
||||
managementEvWatcher = new ManagementEventWatcher(scope, q);
|
||||
managementEvWatcher.EventArrived += PowerEventArrive;
|
||||
managementEvWatcher.Start();
|
||||
try
|
||||
{
|
||||
managementEvWatcher.Start();
|
||||
}
|
||||
catch (ManagementException) { wmiConnected = false; }
|
||||
}
|
||||
else
|
||||
|
||||
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