From 01e5246c614f164ee3a78f5dfe35ed8c86e1770b Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Mon, 26 Feb 2018 03:51:24 -0600 Subject: [PATCH] Use suspending flag rather than using a parameter --- DS4Windows/DS4Control/ControlService.cs | 5 +++-- DS4Windows/DS4Forms/DS4Form.cs | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index 543f4d0..08696de 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -37,6 +37,7 @@ namespace DS4Windows @"HID\{00001124-0000-1000-8000-00805f9b34fb}_VID&0002054c_PID&05c4", @"HID\{00001124-0000-1000-8000-00805f9b34fb}_VID&0002054c_PID&09cc", }; + public bool suspending; //SoundPlayer sp = new SoundPlayer(); private class X360Data @@ -214,7 +215,7 @@ namespace DS4Windows return true; } - public bool Stop(bool showlog = true, bool suspend = false) + public bool Stop(bool showlog = true) { if (running) { @@ -232,7 +233,7 @@ namespace DS4Windows DS4Device tempDevice = DS4Controllers[i]; if (tempDevice != null) { - if ((DCBTatStop && !tempDevice.isCharging()) || suspend) + if ((DCBTatStop && !tempDevice.isCharging()) || suspending) { if (tempDevice.getConnectionType() == ConnectionType.BT) { diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 4925862..7a98c5b 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -507,6 +507,7 @@ namespace DS4Windows { DS4LightBar.shuttingdown = false; wasrunning = false; + Program.rootHub.suspending = false; BtnStartStop_Clicked(); } break; @@ -516,7 +517,8 @@ namespace DS4Windows if (btnStartStop.Text == Properties.Resources.StopText) { DS4LightBar.shuttingdown = true; - BtnStartStop_Clicked(true, true); + Program.rootHub.suspending = true; + BtnStartStop_Clicked(); wasrunning = true; } break; @@ -919,12 +921,12 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question startToolStripMenuItem.Text = btnStartStop.Text = Properties.Resources.StopText; } - private void ServiceShutdown(bool log, bool suspend = false) + private void ServiceShutdown(bool log) { changingService = true; TaskRunner.Run(() => { - Program.rootHub.Stop(log, suspend); + Program.rootHub.Stop(log); Invoke((System.Action)(() => { ServiceShutdownFinish(); })); changingService = false; }); @@ -939,7 +941,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question populateFullNotifyText(); } - public void BtnStartStop_Clicked(bool log = true, bool suspend = false) + public void BtnStartStop_Clicked(bool log = true) { if (btnStartStop.Text == Properties.Resources.StartText) { @@ -948,7 +950,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question else if (btnStartStop.Text == Properties.Resources.StopText) { blankControllerTab(); - ServiceShutdown(log, suspend); + ServiceShutdown(log); } }