mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-23 23:21:49 +01:00
Trim event handler method. Add name for timeout threads.
Decent performance boost with this change
This commit is contained in:
parent
dce5c811f2
commit
5df34b8378
@ -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;
|
||||
@ -1064,39 +1062,27 @@ namespace DS4Windows
|
||||
|
||||
protected void BatteryStatusUpdate(object sender, BatteryReportArgs args)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
string battery;
|
||||
int level = args.getLevel();
|
||||
bool charging = args.isCharging();
|
||||
int Index = args.getIndex();
|
||||
if (charging)
|
||||
{
|
||||
try
|
||||
{
|
||||
BatteryStatusDelegate d = new BatteryStatusDelegate(BatteryStatusUpdate);
|
||||
this.BeginInvoke(d, new object[] { sender, args });
|
||||
}
|
||||
catch { }
|
||||
if (level >= 100)
|
||||
battery = Properties.Resources.Full;
|
||||
else
|
||||
battery = level + "%+";
|
||||
}
|
||||
else
|
||||
{
|
||||
string battery;
|
||||
int level = args.getLevel();
|
||||
bool charging = args.isCharging();
|
||||
int Index = args.getIndex();
|
||||
if (charging)
|
||||
{
|
||||
if (level >= 100)
|
||||
battery = Properties.Resources.Full;
|
||||
else
|
||||
battery = level + "%+";
|
||||
}
|
||||
else
|
||||
{
|
||||
battery = level + "%";
|
||||
}
|
||||
|
||||
Batteries[args.getIndex()].Text = battery;
|
||||
|
||||
// Update device battery level display for tray icon
|
||||
generateDeviceNotifyText(args.getIndex());
|
||||
populateNotifyText();
|
||||
battery = level + "%";
|
||||
}
|
||||
|
||||
Batteries[args.getIndex()].Text = battery;
|
||||
|
||||
// Update device battery level display for tray icon
|
||||
generateDeviceNotifyText(args.getIndex());
|
||||
populateNotifyText();
|
||||
}
|
||||
|
||||
protected void populateFullNotifyText()
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user