mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-23 23:21:49 +01:00
Change battery status change reporting
This commit is contained in:
parent
ac23921978
commit
1958f082c5
@ -659,7 +659,7 @@ namespace DS4Windows
|
||||
}
|
||||
else if (pState.Battery != cState.Battery)
|
||||
{
|
||||
OnBatteryStatusChange(this, ind, cState.Battery);
|
||||
OnBatteryStatusChange(this, ind, cState.Battery, device.isCharging());
|
||||
}
|
||||
|
||||
if (getEnableTouchToggle(ind))
|
||||
|
@ -147,21 +147,28 @@ namespace DS4Windows
|
||||
{
|
||||
private int index;
|
||||
private int level;
|
||||
private bool charging;
|
||||
|
||||
public BatteryReportArgs(int index, int level)
|
||||
public BatteryReportArgs(int index, int level, bool charging)
|
||||
{
|
||||
this.index = index;
|
||||
this.level = level;
|
||||
this.charging = charging;
|
||||
}
|
||||
|
||||
public int getIndex()
|
||||
{
|
||||
return this.index;
|
||||
return index;
|
||||
}
|
||||
|
||||
public int getLevel()
|
||||
{
|
||||
return this.level;
|
||||
return level;
|
||||
}
|
||||
|
||||
public bool isCharging()
|
||||
{
|
||||
return charging;
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,11 +294,11 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
public static event EventHandler<BatteryReportArgs> BatteryStatusChange;
|
||||
public static void OnBatteryStatusChange(object sender, int index, int level)
|
||||
public static void OnBatteryStatusChange(object sender, int index, int level, bool charging)
|
||||
{
|
||||
if (BatteryStatusChange != null)
|
||||
{
|
||||
BatteryReportArgs args = new BatteryReportArgs(index, level);
|
||||
BatteryReportArgs args = new BatteryReportArgs(index, level, charging);
|
||||
BatteryStatusChange(sender, args);
|
||||
}
|
||||
}
|
||||
|
@ -1054,10 +1054,18 @@ namespace DS4Windows
|
||||
{
|
||||
string battery;
|
||||
int level = args.getLevel();
|
||||
if (level >= 100)
|
||||
battery = Properties.Resources.Full;
|
||||
bool charging = args.isCharging();
|
||||
if (charging)
|
||||
{
|
||||
if (level >= 100)
|
||||
battery = Properties.Resources.Full;
|
||||
else
|
||||
battery = level + "%+";
|
||||
}
|
||||
else
|
||||
battery = level + "%+";
|
||||
{
|
||||
battery = level + "%";
|
||||
}
|
||||
|
||||
Batteries[args.getIndex()].Text = battery;
|
||||
}
|
||||
@ -1166,6 +1174,7 @@ namespace DS4Windows
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Possible remove method */
|
||||
/*protected void ControllerStatusChange(object sender, EventArgs e)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
@ -1175,6 +1184,7 @@ namespace DS4Windows
|
||||
}
|
||||
*/
|
||||
|
||||
/* TODO: Possible remove method */
|
||||
/*protected void ControllerStatusChanged()
|
||||
{
|
||||
String tooltip = "DS4Windows v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
|
||||
@ -1262,13 +1272,15 @@ namespace DS4Windows
|
||||
Batteries[device].Visible = on;
|
||||
}
|
||||
|
||||
void ScpForm_Report(object sender, EventArgs e)
|
||||
/* TODO: Remove method in future */
|
||||
/*void ScpForm_Report(object sender, EventArgs e)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
Invoke(new HotKeysDelegate(Hotkeys), new object[] { sender, e });
|
||||
else
|
||||
Hotkeys(sender, e);
|
||||
}
|
||||
*/
|
||||
|
||||
protected void On_Debug(object sender, DebugEventArgs e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user