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