Imroved handling for mice with only a single lighting zone.

This commit is contained in:
IceStormNG
2023-07-30 17:28:08 +02:00
parent e6f9be1bfd
commit 5bf579fec5
2 changed files with 29 additions and 6 deletions

View File

@@ -531,11 +531,21 @@ namespace GHelper
} }
if (mouse.HasRGB()) if (mouse.HasRGB())
{
if (mouse.SupportedLightingZones().Length > 1)
{ {
buttonLightingZoneLogo.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Logo); buttonLightingZoneLogo.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Logo);
buttonLightingZoneScroll.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Scrollwheel); buttonLightingZoneScroll.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Scrollwheel);
buttonLightingZoneUnderglow.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Underglow); buttonLightingZoneUnderglow.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Underglow);
buttonLightingZoneDock.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Dock); buttonLightingZoneDock.Visible = mouse.SupportedLightingZones().Contains(LightingZone.Dock);
}
else
{
buttonLightingZoneLogo.Visible = false;
buttonLightingZoneScroll.Visible = false;
buttonLightingZoneUnderglow.Visible = false;
buttonLightingZoneDock.Visible = false;
}
sliderBrightness.Max = mouse.MaxBrightness(); sliderBrightness.Max = mouse.MaxBrightness();

View File

@@ -174,9 +174,17 @@ namespace GHelper.Peripherals.Mouse
this.path = path; this.path = path;
this.Wireless = wireless; this.Wireless = wireless;
DpiSettings = new AsusMouseDPI[1]; DpiSettings = new AsusMouseDPI[1];
if (SupportedLightingZones().Length == 0)
{
LightingSetting = new LightingSetting[1];
}
else
{
LightingSetting = new LightingSetting[SupportedLightingZones().Length]; LightingSetting = new LightingSetting[SupportedLightingZones().Length];
} }
}
public override bool Equals(object? obj) public override bool Equals(object? obj)
{ {
if (obj is not AsusMouse item) if (obj is not AsusMouse item)
@@ -1068,7 +1076,7 @@ namespace GHelper.Peripherals.Mouse
public virtual LightingZone[] SupportedLightingZones() public virtual LightingZone[] SupportedLightingZones()
{ {
return new LightingZone[] { }; return new LightingZone[] { LightingZone.Logo };
} }
public virtual int IndexForZone(LightingZone zone) public virtual int IndexForZone(LightingZone zone)
@@ -1086,6 +1094,11 @@ namespace GHelper.Peripherals.Mouse
public virtual bool IsLightingZoned() public virtual bool IsLightingZoned()
{ {
if (LightingSetting.Length < 2)
{
return false;
}
//Check whether all zones are the same or not //Check whether all zones are the same or not
for (int i = 1; i < LightingSetting.Length; ++i) for (int i = 1; i < LightingSetting.Length; ++i)
{ {