Trim event handler method. Add name for timeout threads.

Decent performance boost with this change
This commit is contained in:
Travis Nickles 2017-08-21 05:25:18 -05:00
parent dce5c811f2
commit 5df34b8378
2 changed files with 18 additions and 30 deletions

View File

@ -23,8 +23,6 @@ namespace DS4Windows
public string[] arguements;
delegate void LogDebugDelegate(DateTime Time, String Data, bool warning);
delegate void NotificationDelegate(object sender, DebugEventArgs args);
delegate void BatteryStatusDelegate(object sender, BatteryReportArgs args);
delegate void ControllerRemovedDelegate(object sender, ControllerRemovedArgs args);
delegate void DeviceStatusChangedDelegate(object sender, DeviceStatusChangeEventArgs args);
delegate void DeviceSerialChangedDelegate(object sender, SerialChangeArgs args);
protected Label[] Pads, Batteries;
@ -1063,17 +1061,6 @@ namespace DS4Windows
}
protected void BatteryStatusUpdate(object sender, BatteryReportArgs args)
{
if (this.InvokeRequired)
{
try
{
BatteryStatusDelegate d = new BatteryStatusDelegate(BatteryStatusUpdate);
this.BeginInvoke(d, new object[] { sender, args });
}
catch { }
}
else
{
string battery;
int level = args.getLevel();
@ -1097,7 +1084,6 @@ namespace DS4Windows
generateDeviceNotifyText(args.getIndex());
populateNotifyText();
}
}
protected void populateFullNotifyText()
{

View File

@ -483,6 +483,8 @@ namespace DS4Windows
ds4Output.Start();
timeoutCheckThread = new Thread(timeoutTestThread);
timeoutCheckThread.Priority = ThreadPriority.BelowNormal;
timeoutCheckThread.Name = "DS4 Timeout thread: " + Mac;
timeoutCheckThread.IsBackground = true;
timeoutCheckThread.Start();
}