Make sure controller reading can be started when switching auto profiles

Related to issue #325.
This commit is contained in:
Travis Nickles 2018-06-19 00:04:30 -05:00
parent 600818a3c0
commit e0d7f1ed14

View File

@ -449,7 +449,8 @@ namespace DS4Windows
{
if (Index < ControlService.DS4_CONTROLLER_COUNT)
{
statPB[Index].Visible = false; toolTip1.SetToolTip(statPB[Index], "");
statPB[Index].Visible = false;
toolTip1.SetToolTip(statPB[Index], "");
Batteries[Index].Text = Properties.Resources.NA;
Pads[Index].Text = Properties.Resources.Disconnected;
Enable_Controls(Index, false);
@ -594,10 +595,24 @@ namespace DS4Windows
turnOffTemp = true;
if (btnStartStop.Text == Properties.Resources.StopText)
{
autoProfilesTimer.Stop();
hotkeysTimer.Stop();
this.Invoke((System.Action)(() => {
this.changingService = true;
BtnStartStop_Clicked();
}));
while (this.changingService)
{
Thread.SpinWait(500);
}
this.Invoke((System.Action)(() =>
{
hotkeysTimer.Start();
autoProfilesTimer.Start();
btnStartStop.Text = Properties.Resources.StartText;
}));
}
}
@ -619,9 +634,11 @@ namespace DS4Windows
{
turnOffTemp = false;
if (btnStartStop.Text == Properties.Resources.StartText)
{
this.BeginInvoke((System.Action)(() =>
{
BtnStartStop_Clicked();
btnStartStop.Text = Properties.Resources.StopText;
}));
}
}
}