Seems to best fix issues with suspending. The delay is MS fault

Related to issue #730
This commit is contained in:
Travis Nickles 2019-07-28 21:53:41 -05:00
parent af9557e53b
commit 1f66d984cd

View File

@ -652,6 +652,7 @@ namespace DS4Windows.Forms
DS4LightBar.shuttingdown = false; DS4LightBar.shuttingdown = false;
wasrunning = false; wasrunning = false;
Program.rootHub.suspending = false; Program.rootHub.suspending = false;
Thread.Sleep(8000);
this.Invoke((System.Action)(() => BtnStartStop_Clicked())); this.Invoke((System.Action)(() => BtnStartStop_Clicked()));
} }
@ -663,13 +664,17 @@ namespace DS4Windows.Forms
{ {
DS4LightBar.shuttingdown = true; DS4LightBar.shuttingdown = true;
Program.rootHub.suspending = true; Program.rootHub.suspending = true;
this.Invoke((System.Action)(() => BtnStartStop_Clicked())); changingService = true;
wasrunning = true;
while (this.changingService) Program.rootHub.Stop(true);
{
Thread.SpinWait(500); Invoke((System.Action)(() => {
} ServiceShutdownFinish();
btnStartStop.Enabled = false;
}));
changingService = false;
//this.Invoke((System.Action)(() => BtnStartStop_Clicked()));
wasrunning = true;
} }
break; break;