Remove async usage in method

This commit is contained in:
Travis Nickles 2017-08-24 23:08:35 -05:00
parent 3e217266c5
commit 644c674a27

View File

@ -96,11 +96,10 @@ namespace DS4Windows
dcs.Add(DS4Controls.SwipeRight); dcs.Add(DS4Controls.SwipeRight);
} }
private async void WarnExclusiveModeFailure(DS4Device device) private void WarnExclusiveModeFailure(DS4Device device)
{ {
if (DS4Devices.isExclusiveMode && !device.isExclusive()) if (DS4Devices.isExclusiveMode && !device.isExclusive())
{ {
await Task.Delay(5);
string message = Properties.Resources.CouldNotOpenDS4.Replace("*Mac address*", device.getMacAddress()) + " " + string message = Properties.Resources.CouldNotOpenDS4.Replace("*Mac address*", device.getMacAddress()) + " " +
Properties.Resources.QuitOtherPrograms; Properties.Resources.QuitOtherPrograms;
LogDebug(message, true); LogDebug(message, true);
@ -138,7 +137,9 @@ namespace DS4Windows
if (showlog) if (showlog)
LogDebug(Properties.Resources.FoundController + device.getMacAddress() + " (" + device.getConnectionType() + ")"); LogDebug(Properties.Resources.FoundController + device.getMacAddress() + " (" + device.getConnectionType() + ")");
WarnExclusiveModeFailure(device); Task task = new Task(() => { Thread.Sleep(5); WarnExclusiveModeFailure(device); });
task.Start();
DS4Controllers[i] = device; DS4Controllers[i] = device;
device.setUiContext(SynchronizationContext.Current); device.setUiContext(SynchronizationContext.Current);
device.Removal += this.On_DS4Removal; device.Removal += this.On_DS4Removal;
@ -315,7 +316,8 @@ namespace DS4Windows
if (DS4Controllers[Index] == null) if (DS4Controllers[Index] == null)
{ {
LogDebug(Properties.Resources.FoundController + device.getMacAddress() + " (" + device.getConnectionType() + ")"); LogDebug(Properties.Resources.FoundController + device.getMacAddress() + " (" + device.getConnectionType() + ")");
WarnExclusiveModeFailure(device); Task task = new Task(() => { Thread.Sleep(5); WarnExclusiveModeFailure(device); });
task.Start();
DS4Controllers[Index] = device; DS4Controllers[Index] = device;
device.setUiContext(uiContext); device.setUiContext(uiContext);
device.Removal += this.On_DS4Removal; device.Removal += this.On_DS4Removal;