From 1f66d984cd7bc5380513bff6551516b7a764f3d0 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sun, 28 Jul 2019 21:53:41 -0500 Subject: [PATCH] Seems to best fix issues with suspending. The delay is MS fault Related to issue #730 --- DS4Windows/DS4Forms/DS4Form.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index d76df50..4df11b7 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -652,6 +652,7 @@ namespace DS4Windows.Forms DS4LightBar.shuttingdown = false; wasrunning = false; Program.rootHub.suspending = false; + Thread.Sleep(8000); this.Invoke((System.Action)(() => BtnStartStop_Clicked())); } @@ -663,13 +664,17 @@ namespace DS4Windows.Forms { DS4LightBar.shuttingdown = true; Program.rootHub.suspending = true; - this.Invoke((System.Action)(() => BtnStartStop_Clicked())); - wasrunning = true; + changingService = true; - while (this.changingService) - { - Thread.SpinWait(500); - } + Program.rootHub.Stop(true); + + Invoke((System.Action)(() => { + ServiceShutdownFinish(); + btnStartStop.Enabled = false; + })); + changingService = false; + //this.Invoke((System.Action)(() => BtnStartStop_Clicked())); + wasrunning = true; } break;