Better handling of wireless devies that get turned off. The dongle still responds but it sends empty packets.

This commit is contained in:
IceStormNG
2023-07-26 21:01:39 +02:00
parent f9a8665290
commit 6c6c93b378
3 changed files with 48 additions and 6 deletions

View File

@@ -89,6 +89,22 @@ namespace GHelper
{
mouse.BatteryUpdated -= Mouse_BatteryUpdated;
mouse.Disconnect -= Mouse_Disconnect;
mouse.MouseReadyChanged -= Mouse_MouseReadyChanged;
}
private void Mouse_MouseReadyChanged(object? sender, EventArgs e)
{
if (!mouse.IsDeviceReady)
{
this.Invoke(delegate
{
if (Disposing || IsDisposed)
{
return;
}
Close();
});
}
}
private void Mouse_BatteryUpdated(object? sender, EventArgs e)
@@ -606,6 +622,10 @@ namespace GHelper
for (int i = 0; i < mouse.DPIProfileCount() && i < 4; ++i)
{
AsusMouseDPI dpi = mouse.DpiSettings[i];
if (dpi is null)
{
continue;
}
if (mouse.HasDPIColors())
{
dpiButtons[i].Image = ControlHelper.TintImage(Properties.Resources.lighting_dot_24, dpi.Color);
@@ -641,6 +661,7 @@ namespace GHelper
mouse.Disconnect += Mouse_Disconnect;
mouse.BatteryUpdated += Mouse_BatteryUpdated;
mouse.MouseReadyChanged += Mouse_MouseReadyChanged;
}
private void ButtonSync_Click(object sender, EventArgs e)