From d9cba16218a99a3c2eb23bb31a8b7931a14c839b Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sat, 22 Jul 2023 22:47:14 +0200 Subject: [PATCH 01/34] Added additional logic to the AnimeMatrix USB classes to re-use them. --- app/AnimeMatrix/Communication/Device.cs | 31 ++++++++++++--- .../Communication/Platform/UsbProvider.cs | 4 +- .../Platform/WindowsUsbProvider.cs | 38 +++++++++++++++++++ 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/app/AnimeMatrix/Communication/Device.cs b/app/AnimeMatrix/Communication/Device.cs index 453d3369..93453649 100644 --- a/app/AnimeMatrix/Communication/Device.cs +++ b/app/AnimeMatrix/Communication/Device.cs @@ -6,11 +6,17 @@ namespace GHelper.AnimeMatrix.Communication { public abstract class Device : IDisposable { - private static UsbProvider _usbProvider; + protected UsbProvider? _usbProvider; - private static ushort _vendorId; - private static ushort _productId; - private static int _maxFeatureReportLength; + protected ushort _vendorId; + protected ushort _productId; + protected int _maxFeatureReportLength; + + protected Device(ushort vendorId, ushort productId) + { + _vendorId = vendorId; + _productId = productId; + } protected Device(ushort vendorId, ushort productId, int maxFeatureReportLength) { @@ -20,7 +26,17 @@ namespace GHelper.AnimeMatrix.Communication SetProvider(); } - public void SetProvider() + public ushort VendorID() + { + return _vendorId; + } + + public ushort ProductID() + { + return _productId; + } + + public virtual void SetProvider() { _usbProvider = new WindowsUsbProvider(_vendorId, _productId, _maxFeatureReportLength); } @@ -36,6 +52,11 @@ namespace GHelper.AnimeMatrix.Communication public byte[] Get(Packet packet) => _usbProvider?.Get(packet.Data); + public void Read(byte[] data) + => _usbProvider?.Read(data); + public void Write(byte[] data) + => _usbProvider?.Write(data); + public void Dispose() { _usbProvider?.Dispose(); diff --git a/app/AnimeMatrix/Communication/Platform/UsbProvider.cs b/app/AnimeMatrix/Communication/Platform/UsbProvider.cs index b7488b8c..05098e8e 100644 --- a/app/AnimeMatrix/Communication/Platform/UsbProvider.cs +++ b/app/AnimeMatrix/Communication/Platform/UsbProvider.cs @@ -1,6 +1,6 @@ namespace GHelper.AnimeMatrix.Communication.Platform { - internal abstract class UsbProvider : IDisposable + public abstract class UsbProvider : IDisposable { protected ushort VendorID { get; } protected ushort ProductID { get; } @@ -13,6 +13,8 @@ namespace GHelper.AnimeMatrix.Communication.Platform public abstract void Set(byte[] data); public abstract byte[] Get(byte[] data); + public abstract void Read(byte[] data); + public abstract void Write(byte[] data); public abstract void Dispose(); } diff --git a/app/AnimeMatrix/Communication/Platform/WindowsUsbProvider.cs b/app/AnimeMatrix/Communication/Platform/WindowsUsbProvider.cs index 23d6415f..1a8630fa 100644 --- a/app/AnimeMatrix/Communication/Platform/WindowsUsbProvider.cs +++ b/app/AnimeMatrix/Communication/Platform/WindowsUsbProvider.cs @@ -8,6 +8,27 @@ namespace GHelper.AnimeMatrix.Communication.Platform protected HidDevice HidDevice { get; } protected HidStream HidStream { get; } + public WindowsUsbProvider(ushort vendorId, ushort productId, string path, int timeout = 500) : base(vendorId, productId) + { + try + { + HidDevice = DeviceList.Local.GetHidDevices(vendorId, productId) + .First(x => x.DevicePath.Contains(path)); + } + catch + { + throw new IOException("HID device was not found on your machine."); + } + + var config = new OpenConfiguration(); + config.SetOption(OpenOption.Interruptible, true); + config.SetOption(OpenOption.Exclusive, false); + config.SetOption(OpenOption.Priority, 10); + HidStream = HidDevice.Open(config); + HidStream.ReadTimeout = timeout; + HidStream.WriteTimeout = timeout; + } + public WindowsUsbProvider(ushort vendorId, ushort productId, int maxFeatureReportLength) : base(vendorId, productId) { @@ -53,6 +74,23 @@ namespace GHelper.AnimeMatrix.Communication.Platform return data; } + public override void Read(byte[] data) + { + WrapException(() => + { + HidStream.Read(data); + }); + } + + public override void Write(byte[] data) + { + WrapException(() => + { + HidStream.Write(data); + HidStream.Flush(); + }); + } + public override void Dispose() { HidStream.Dispose(); From f80db2c770646ce1abbddc1ffd6674dec8f029aa Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sat, 22 Jul 2023 22:51:03 +0200 Subject: [PATCH 02/34] Added ASUS Mouse Control Protocol + Implementation for Chakram X (Dongle and Wired) --- app/Peripherals/Mouse/AsusMouse.cs | 870 +++++++++++++++++++++++ app/Peripherals/Mouse/Models/ChakramX.cs | 95 +++ app/Peripherals/PeripheralsProvider.cs | 102 +++ 3 files changed, 1067 insertions(+) create mode 100644 app/Peripherals/Mouse/AsusMouse.cs create mode 100644 app/Peripherals/Mouse/Models/ChakramX.cs create mode 100644 app/Peripherals/PeripheralsProvider.cs diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs new file mode 100644 index 00000000..a9dda3d3 --- /dev/null +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -0,0 +1,870 @@ +using GHelper.AnimeMatrix.Communication; +using GHelper.AnimeMatrix.Communication.Platform; +using System.Runtime.CompilerServices; +using System.Text; + +namespace GHelper.Peripherals.Mouse +{ + public enum PowerOffSetting + { + Minutes1 = 0, + Minutes2 = 1, + Minutes3 = 2, + Minutes5 = 3, + Minutes10 = 4, + Never = 0xFF + } + + public enum LiftOffDistance + { + Low = 0, + High = 1 + } + public enum AnimationDirection + { + Clockwise = 0x0, + CounterClockwise = 0x1 + } + + public enum LightingSpeed + { + Slow = 0x9, + Medium = 0x7, + Fast = 0x5 + } + public enum LightingMode + { + Static = 0x0, + Breathing = 0x1, + Colorwheel = 0x2, + Rainbow = 0x3, + React = 0x4, + Comet = 0x5, + BatteryState = 0x6 + } + + public class LightingSetting + { + public LightingSetting() + { + //Some Sane defaults + LightingMode = LightingMode.Static; + LightingSpeed = LightingSpeed.Medium; + AnimationDirection = AnimationDirection.Clockwise; + RandomColor = false; + Brightness = 25; + RGBColor = Color.Red; + } + + public LightingMode LightingMode { get; set; } + public int Brightness { get; set; } + public Color RGBColor { get; set; } + public bool RandomColor { get; set; } + public LightingSpeed LightingSpeed { get; set; } + + public AnimationDirection AnimationDirection { get; set; } + + public override string? ToString() + { + return "LightingMode: " + LightingMode + ", Color (" + RGBColor.R + ", " + RGBColor.G + ", " + RGBColor.B + + "), Brightness: " + Brightness + "%, LightingSpeed: " + LightingSpeed + ", RandomColor:" + RandomColor + ", AnimationDirection:" + AnimationDirection; + } + } + + public class AsusMouseDPI + { + public AsusMouseDPI() + { + Color = Color.Red; + DPI = 800; + } + public Color Color { get; set; } + public uint DPI { get; set; } + public override string? ToString() + { + return "DPI: " + DPI + ", Color (" + Color.R + ", " + Color.G + ", " + Color.B + ")"; + } + } + + public abstract class AsusMouse : Device + { + internal const int ASUS_MOUSE_PACKET_SIZE = 65; + + public event EventHandler? Disconnect; + + private readonly string path; + + public bool MouseIsReady { get; protected set; } + public bool Wireless { get; protected set; } + public int Battery { get; protected set; } + public bool Charging { get; protected set; } + public LightingSetting? LightingSetting { get; protected set; } + public int LowBatteryWarning { get; protected set; } + public PowerOffSetting PowerOffSetting { get; protected set; } + public LiftOffDistance LiftOffDistance { get; protected set; } + public int DpiProfile { get; protected set; } + public AsusMouseDPI[] DpiSettings { get; protected set; } + public int Profile { get; protected set; } + public int PollingRate1 { get; protected set; } + public bool AngleSnapping { get; protected set; } + public short AngleAdjustmentDegrees { get; protected set; } + + public AsusMouse(ushort vendorId, ushort productId, string path, bool wireless) : base(vendorId, productId) + { + this.path = path; + this.Wireless = wireless; + DpiSettings = new AsusMouseDPI[1]; + } + + public override bool Equals(object? obj) + { + if (obj is not AsusMouse item) + { + return false; + } + + return this.VendorID().Equals(item.VendorID()) + && this.ProductID().Equals(item.ProductID()) + && this.path.Equals(item.path); + } + + public override int GetHashCode() + { + int hash = 23; + hash = hash * 31 + VendorID(); + hash = hash * 31 + ProductID(); + hash = hash * 31 + path.GetHashCode(); + return hash; + } + + public void Connect() + { + SetProvider(); + HidSharp.DeviceList.Local.Changed += Device_Changed; + } + + private void Device_Changed(object? sender, HidSharp.DeviceListChangedEventArgs e) + { + //Use this to validate whether the device is still connected. + //If not, this will also initiate the disconnect and cleanup sequence. + ReadBattery(); + } + + public bool IsDeviceConnected() + { + try + { + HidSharp.DeviceList.Local.GetHidDevices(VendorID(), ProductID()) + .First(x => x.DevicePath.Contains(path)); + return true; + } + catch + { + return false; + } + } + + public override void SetProvider() + { + _usbProvider = new WindowsUsbProvider(_vendorId, _productId, path); + } + + protected virtual void OnDisconnect() + { + if (Disconnect is not null) + { + Disconnect(this, EventArgs.Empty); + } + } + + [MethodImpl(MethodImplOptions.Synchronized)] + protected virtual byte[]? WriteForResponse(byte[] packet) + { + byte[] response = new byte[ASUS_MOUSE_PACKET_SIZE]; + + try + { + Logger.WriteLine(GetDisplayName() + ": Sending packet: " + ByteArrayToString(packet)); + Write(packet); + + Read(response); + Logger.WriteLine(GetDisplayName() + ": Read packet: " + ByteArrayToString(response)); + } + catch (IOException e) + { + Logger.WriteLine(GetDisplayName() + ": Failed to read packet " + e.Message); + OnDisconnect(); + return null; + } + catch (System.TimeoutException e) + { + Logger.WriteLine(GetDisplayName() + ": Timeout reading packet " + e.Message); + return null; + } + + + return response; + } + public abstract string GetDisplayName(); + + + public virtual void SynchronizeMouse() + { + DpiSettings = new AsusMouseDPI[DPIProfileCount()]; + ReadBattery(); + if (Wireless && Battery == 0 && Charging == false) + { + //Likely only the dongle connected and the mouse is either sleeping or turned off. + //The mouse will not respond with proper data, but empty responses at this point + MouseIsReady = false; + return; + } + MouseIsReady = true; + + ReadProfile(); + ReadDPI(); + ReadLightingSetting(); + ReadLiftOffDistance(); + ReadPollingRate(); + } + + // ------------------------------------------------------------------------------ + // Battery + // ------------------------------------------------------------------------------ + + protected virtual bool HasEnergySettings() + { + return false; + } + + protected virtual byte[] GetBatteryReportPacket() + { + return new byte[] { 0x00, 0x12, 0x07 }; + } + + protected virtual int ParseBattery(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x07) + { + return packet[5]; + } + + return -1; + } + protected virtual bool ParseChargingState(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x07) + { + return packet[10] > 0; + } + + return false; + } + + protected virtual PowerOffSetting ParsePowerOffSetting(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x07) + { + return (PowerOffSetting)packet[6]; + } + + return PowerOffSetting.Never; + } + protected virtual int ParseLowBatteryWarning(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x07) + { + return packet[7]; + } + + return 0; + } + + public void ReadBattery() + { + byte[]? response = WriteForResponse(GetBatteryReportPacket()); + if (response is null) return; + + Battery = ParseBattery(response); + Charging = ParseChargingState(response); + PowerOffSetting = ParsePowerOffSetting(response); + LowBatteryWarning = ParseLowBatteryWarning(response); + + Logger.WriteLine(GetDisplayName() + ": Got Battery Percentage " + Battery + "% - Charging:" + Charging); + Logger.WriteLine(GetDisplayName() + ": Got Auto Power Off: " + PowerOffSetting + " - Low Battery Warnning at: " + LowBatteryWarning + "%"); + } + + // ------------------------------------------------------------------------------ + // Profiles + // ------------------------------------------------------------------------------ + public abstract int ProfileCount(); + + protected virtual bool HasProfiles() + { + return true; + } + + protected virtual int ParseProfile(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x00 && packet[3] == 0x00) + { + return packet[11]; + } + Logger.WriteLine(GetDisplayName() + ": Failed to decode active profile"); + return 1; + } + + protected virtual int ParseDPIProfile(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x00 && packet[3] == 0x00) + { + return packet[12]; + } + Logger.WriteLine(GetDisplayName() + ": Failed to decode active profile"); + return 1; + } + + protected virtual byte[] GetReadProfilePacket() + { + return new byte[] { 0x00, 0x12, 0x00 }; + } + + protected virtual byte[] GetUpdateProfilePacket(int profile) + { + return new byte[] { 0x00, 0x50, 0x02, (byte)profile }; + } + + public void ReadProfile() + { + if (!HasProfiles()) + { + return; + } + + byte[]? response = WriteForResponse(GetReadProfilePacket()); + if (response is null) return; + + Profile = ParseProfile(response); + if (DPIProfileCount() > 1) + { + + DpiProfile = ParseDPIProfile(response); + } + Logger.WriteLine(GetDisplayName() + ": Active Profile " + (Profile + 1) + + ((DPIProfileCount() > 1 ? ", Active DPI Profile: " + DpiProfile : ""))); + } + + public void SetProfile(int profile) + { + if (!HasProfiles()) + { + return; + } + + if (profile > ProfileCount() || profile < 0) + { + Logger.WriteLine(GetDisplayName() + ": Profile:" + profile + " is invalid."); + return; + } + + WriteForResponse(GetUpdateProfilePacket(profile)); + + Logger.WriteLine(GetDisplayName() + ": Profile set to " + profile); + this.Profile = profile; + } + + // ------------------------------------------------------------------------------ + // Polling Rate and Angle Snapping + // ------------------------------------------------------------------------------ + + public int PollingRate() + { + return PollingRate1; + } + + public virtual bool HasAngleSnapping() + { + return false; + } + + public abstract string PollingRateDisplayString(int pollingRate); + public abstract int PollingRateCount(); + + + protected virtual bool CanSetPollingRate() + { + return true; + } + + protected virtual byte[] GetReadPollingRatePacket() + { + return new byte[] { 0x00, 0x12, 0x04, 0x00 }; + } + + protected virtual byte[] GetUpdatePollingRatePacket(int pollingRate) + { + return new byte[] { 0x00, 0x51, 0x31, 0x04, 0x00, (byte)pollingRate }; + } + protected virtual byte[] GetUpdateAngleSnappingPacket(bool angleSnappin) + { + return new byte[] { 0x00, 0x51, 0x31, 0x06, 0x00, (byte)(AngleSnapping ? 0x01 : 0x00) }; + } + protected virtual byte[] GetUpdateAngleAdjustmentPacket(short angleAdjustment) + { + return new byte[] { 0x00, 0x51, 0x31, 0x0B, 0x00, (byte)(angleAdjustment & 0xFF), (byte)((angleAdjustment >> 8) & 0xFF) }; + } + + protected virtual int ParsePollingRate(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return packet[13]; + } + + return -1; + } + + protected virtual bool ParseAngleSnapping(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return packet[17] == 0x01; + } + + return false; + } + + protected virtual short ParseAngleAdjustment(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return (short)(packet[19] << 8 | packet[20]); + } + + return 0; + } + + public void ReadPollingRate() + { + if (!CanSetPollingRate()) + { + return; + } + + byte[]? response = WriteForResponse(GetReadPollingRatePacket()); + if (response is null) return; + + PollingRate1 = ParsePollingRate(response); + Logger.WriteLine(GetDisplayName() + ": Pollingrate: " + PollingRateDisplayString(PollingRate1) + " (" + PollingRate1 + ")"); + + if (HasAngleSnapping()) + { + AngleSnapping = ParseAngleSnapping(response); + AngleAdjustmentDegrees = ParseAngleAdjustment(response); + Logger.WriteLine(GetDisplayName() + ": Angle Snapping enabled: " + AngleSnapping + ", Angle Adjustment: " + AngleAdjustmentDegrees + "°"); + } + } + + public void SetPollingRate(int pollingRate) + { + if (!CanSetPollingRate()) + { + return; + } + + if (pollingRate > PollingRateCount() || pollingRate < 1) + { + Logger.WriteLine(GetDisplayName() + ": Pollingrate:" + pollingRate + " is invalid."); + return; + } + + WriteForResponse(GetUpdatePollingRatePacket(pollingRate)); + + Logger.WriteLine(GetDisplayName() + ": Pollingrate set to " + PollingRateDisplayString(pollingRate)); + this.PollingRate1 = pollingRate; + } + + public void SetAngleSnapping(bool angleSnapping) + { + if (!HasAngleSnapping()) + { + return; + } + + WriteForResponse(GetUpdateAngleSnappingPacket(angleSnapping)); + + Logger.WriteLine(GetDisplayName() + ": Angle Snapping set to " + angleSnapping); + this.AngleSnapping = angleSnapping; + } + + public void SetAngleAdjustment(short angleAdjustment) + { + if (!HasAngleSnapping()) + { + return; + } + + if (angleAdjustment < -20 || angleAdjustment > 20) + { + Logger.WriteLine(GetDisplayName() + ": Angle Adjustment:" + angleAdjustment + " is outside of range [-20;20]."); + return; + } + + WriteForResponse(GetUpdateAngleAdjustmentPacket(angleAdjustment)); + + Logger.WriteLine(GetDisplayName() + ": Angle Adjustment set to " + angleAdjustment); + this.AngleAdjustmentDegrees = angleAdjustment; + } + + // ------------------------------------------------------------------------------ + // DPI + // ------------------------------------------------------------------------------ + protected abstract int DPIProfileCount(); + protected virtual bool HasDPIColors() + { + return true; + } + + protected virtual bool CanChangeDPIProfile() + { + return DPIProfileCount() > 1; + } + + protected virtual int MaxDPI() + { + return 2000; + } + protected virtual int MinDPI() + { + return 100; + } + + protected virtual byte[] GetChangeDPIProfilePacket(int profile) + { + return new byte[] { 0x00, 0x51, 0x31, 0x09, 0x00, (byte)profile }; + } + + //There is no API to read this out from the mouse. Armoury Crate also doesn't read it. + //You can however get the HID button event when you change the profile via a mouse button which tells you the profile it was set to + public void SetDPIProfile(int profile) + { + if (!CanChangeDPIProfile()) + { + return; + } + + if (profile >= DPIProfileCount() || profile < 0) + { + Logger.WriteLine(GetDisplayName() + ": DPI Profile:" + profile + " is invalid."); + return; + } + + //The first DPI profile is 1 + WriteForResponse(GetChangeDPIProfilePacket(profile + 1)); + + Logger.WriteLine(GetDisplayName() + ": DPI Profile set to " + profile); + this.DpiProfile = profile; + } + + protected virtual byte[] GetReadDPIPacket() + { + return new byte[] { 0x00, 0x12, 0x04, 0x02 }; + } + + protected virtual byte[]? GetUpdateDPIPacket(int profile) + { + AsusMouseDPI dpi = DpiSettings[profile]; + if (dpi is null) + { + return null; + } + if (dpi.DPI > MaxDPI() || dpi.DPI < MinDPI()) + { + return null; + } + ushort dpiEncoded = (ushort)((dpi.DPI - 50) / 50); + + if (HasDPIColors()) + { + return new byte[] { 0x00, 0x51, 0x31, 0x00, (byte)(dpiEncoded & 0xFF), (byte)((dpiEncoded >> 8) & 0xFF), (byte)profile, dpi.Color.R, dpi.Color.G, dpi.Color.B }; + } + else + { + return new byte[] { 0x00, 0x51, 0x31, 0x00, (byte)(dpiEncoded & 0xFF), (byte)((dpiEncoded >> 8) & 0xFF), (byte)profile }; + } + + } + + protected virtual void ParseDPI(byte[] packet) + { + if (packet[1] != 0x12 || packet[2] != 0x04 || packet[3] != 0x02) + { + return; + } + + for (int i = 0; i < DPIProfileCount(); ++i) + { + if (DpiSettings[i] is null) + { + DpiSettings[i] = new AsusMouseDPI(); + } + + int offset = 4 + (i * 4); + + DpiSettings[i].DPI = (uint)(packet[offset] << 8 | packet[offset + 1]) * 50 + 50; + } + } + + protected virtual byte[] GetReadDPIColorsPacket() + { + return new byte[] { 0x00, 0x12, 0x04, 0x03 }; + } + + protected virtual void ParseDPIColors(byte[] packet) + { + if (packet[1] != 0x12 || packet[2] != 0x04 || packet[3] != 0x03) + { + return; + } + + for (int i = 0; i < DPIProfileCount(); ++i) + { + if (DpiSettings[i] is null) + { + DpiSettings[i] = new AsusMouseDPI(); + } + + int offset = 5 + (i * 3); + + DpiSettings[i].Color = Color.FromArgb(packet[offset], packet[offset + 1], packet[offset + 2]); + } + } + + public void ReadDPI() + { + byte[]? response = WriteForResponse(GetReadDPIPacket()); + if (response is null) return; + ParseDPI(response); + + if (HasDPIColors()) + { + response = WriteForResponse(GetReadDPIColorsPacket()); + if (response is null) return; + ParseDPIColors(response); + } + + for (int i = 0; i < DPIProfileCount(); ++i) + { + + Logger.WriteLine(GetDisplayName() + ": Read DPI Setting " + (i + 1) + ": " + DpiSettings[i].ToString()); + } + + } + + public void SetDPIForProfile(int profile) + { + if (profile >= DPIProfileCount() || profile < 0) + { + Logger.WriteLine(GetDisplayName() + ": DPI Profile:" + profile + " is invalid."); + return; + } + + byte[]? packet = GetUpdateDPIPacket(profile); + if (packet == null) + { + Logger.WriteLine(GetDisplayName() + ": DPI setting for profile " + profile + " does not exist or is invalid."); + return; + } + WriteForResponse(packet); + + Logger.WriteLine(GetDisplayName() + ": DPI for profile " + profile + " set to " + DpiSettings[profile].DPI); + this.DpiProfile = profile; + } + + + + // ------------------------------------------------------------------------------ + // Lift-off Distance + // ------------------------------------------------------------------------------ + + protected virtual bool HasLiftOffSetting() + { + return false; + } + + protected virtual byte[] GetReadLiftOffDistancePacket() + { + return new byte[] { 0x00, 0x12, 0x06 }; + } + + //This also resets the "calibration" to default. There is no seperate command to only set the lift off distance + protected virtual byte[] GetUpdateLiftOffDistancePacket(LiftOffDistance liftOffDistance) + { + return new byte[] { 0x00, 0x51, 0x35, 0xFF, 0x00, 0xFF, ((byte)liftOffDistance) }; + } + + protected virtual LiftOffDistance ParseLiftOffDistance(byte[] packet) + { + if (packet[1] != 0x12 || packet[2] != 0x06) + { + return LiftOffDistance.Low; + } + + return (LiftOffDistance)packet[8]; + } + + public void ReadLiftOffDistance() + { + if (!HasLiftOffSetting()) + { + return; + } + byte[]? response = WriteForResponse(GetReadLiftOffDistancePacket()); + if (response is null) return; + + LiftOffDistance = ParseLiftOffDistance(response); + + + Logger.WriteLine(GetDisplayName() + ": Read Lift Off Setting: " + LiftOffDistance); + } + + public void SetLiftOffDistance(LiftOffDistance liftOffDistance) + { + if (!HasLiftOffSetting()) + { + return; + } + + WriteForResponse(GetUpdateLiftOffDistancePacket(liftOffDistance)); + + Logger.WriteLine(GetDisplayName() + ": Set Liftoff Distance to " + liftOffDistance); + this.LiftOffDistance = liftOffDistance; + } + + // ------------------------------------------------------------------------------ + // RGB + // ------------------------------------------------------------------------------ + + protected virtual bool HasRGB() + { + return false; + } + + //Override to remap lighting mode IDs. + //From OpenRGB code it looks like some mice have different orders of the modes or do not support some modes at all. + protected virtual byte IndexForLightingMode(LightingMode lightingMode) + { + return ((byte)lightingMode); + } + + //Also override this for the reverse mapping + protected virtual LightingMode LightingModeForIndex(byte lightingMode) + { + return ((LightingMode)lightingMode); + } + + //And this if not all modes are supported + protected virtual bool IsLightingModeSupported(LightingMode lightingMode) + { + return true; + } + + protected virtual byte[] GetReadLightingModePacket() + { + return new byte[] { 0x00, 0x12, 0x03 }; + } + + protected virtual byte[] GetUpdateLightingModePacket(LightingSetting lightingSetting) + { + if (lightingSetting.Brightness < 0 || lightingSetting.Brightness > 100) + { + Logger.WriteLine(GetDisplayName() + ": Brightness " + lightingSetting.Brightness + " is out of range [0;100]. Setting to 25."); + lightingSetting.Brightness = 25; + } + if (!IsLightingModeSupported(lightingSetting.LightingMode)) + { + Logger.WriteLine(GetDisplayName() + ": Lighting Mode " + lightingSetting.LightingMode + " is not supported. Setting to Rainbow ;)"); + lightingSetting.LightingMode = LightingMode.Rainbow; + } + + return new byte[] { 0x00, 0x51, 0x28, 0x03, 0x00, + IndexForLightingMode(lightingSetting.LightingMode), + (byte)lightingSetting.Brightness, + lightingSetting.RGBColor.R, lightingSetting.RGBColor.G, lightingSetting.RGBColor.B, + (byte)lightingSetting.AnimationDirection, + (byte)(lightingSetting.RandomColor ? 0x01: 0x00), + (byte)lightingSetting.LightingSpeed + }; + } + + protected virtual LightingSetting? ParseLightingSetting(byte[] packet) + { + if (packet[1] != 0x12 || packet[2] != 0x03) + { + return null; + } + + LightingSetting setting = new LightingSetting(); + + setting.LightingMode = LightingModeForIndex(packet[5]); + setting.Brightness = packet[6]; + + setting.RGBColor = Color.FromArgb(packet[7], packet[8], packet[9]); + setting.AnimationDirection = (AnimationDirection)packet[10]; + setting.RandomColor = packet[11] == 0x01; + setting.LightingSpeed = (LightingSpeed)packet[12]; + + + return setting; + } + + public void ReadLightingSetting() + { + if (!HasRGB()) + { + return; + } + byte[]? response = WriteForResponse(GetReadLightingModePacket()); + if (response is null) return; + + LightingSetting = ParseLightingSetting(response); + + if (LightingSetting is not null) + { + Logger.WriteLine(GetDisplayName() + ": Read RGB Setting" + LightingSetting.ToString()); + } + else + { + Logger.WriteLine(GetDisplayName() + ": Failed to read RGB Setting"); + } + } + + public void SetLightingSettinge(LightingSetting lightingSetting) + { + if (!HasRGB() || lightingSetting is null) + { + return; + } + + WriteForResponse(GetUpdateLightingModePacket(lightingSetting)); + + Logger.WriteLine(GetDisplayName() + ": Set RGB Setting " + lightingSetting.ToString()); + this.LightingSetting = lightingSetting; + } + + public override string? ToString() + { + return ""; + + } + + + public static string ByteArrayToString(byte[] packet) + { + StringBuilder hex = new StringBuilder(packet.Length * 2); + foreach (byte b in packet) + hex.AppendFormat("{0:x2} ", b); + return hex.ToString(); + } + } +} diff --git a/app/Peripherals/Mouse/Models/ChakramX.cs b/app/Peripherals/Mouse/Models/ChakramX.cs new file mode 100644 index 00000000..3e01034b --- /dev/null +++ b/app/Peripherals/Mouse/Models/ChakramX.cs @@ -0,0 +1,95 @@ + +namespace GHelper.Peripherals.Mouse.Models +{ + public class ChakramX : AsusMouse + { + internal static string[] POLLING_RATES = { "250Hz", "500Hz", "1000Hz" }; + + public ChakramX() : base(0x0B05, 0x1A1A, "mi_00", true) + { + } + + protected ChakramX(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_00", wireless) + { + } + + public override string GetDisplayName() + { + return "ROG Chakram X (Wireless)"; + } + + public override string PollingRateDisplayString(int pollingRate) + { + if (pollingRate >= 1 && pollingRate <= POLLING_RATES.Length) + { + return POLLING_RATES[pollingRate - 1]; + } + + return "Unknown"; + } + + public override bool HasAngleSnapping() + { + return true; + } + + public override int PollingRateCount() + { + return 3; + } + + public override int ProfileCount() + { + return 5; + } + + protected override int DPIProfileCount() + { + return 4; + } + + protected override int MaxDPI() + { + return 65_000; + } + + protected override bool HasLiftOffSetting() + { + return true; + } + + protected override bool HasRGB() + { + return true; + } + + protected override bool HasEnergySettings() + { + return true; + } + + } + + public class ChakramXWired : ChakramX + { + internal new static string[] POLLING_RATES = { "250Hz", "500Hz", "1000Hz", "2000Hz", "4000Hz", "8000Hz" }; + public ChakramXWired() : base(0x1A18, false) + { + } + + public override string GetDisplayName() + { + return "ROG Chakram X (Wired)"; + } + + public override string PollingRateDisplayString(int pollingRate) + { + if (pollingRate >= 1 && pollingRate <= POLLING_RATES.Length) + { + return POLLING_RATES[pollingRate - 1]; + } + + return "Unknown"; + } + } +} diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs new file mode 100644 index 00000000..30ddc3b5 --- /dev/null +++ b/app/Peripherals/PeripheralsProvider.cs @@ -0,0 +1,102 @@ +using GHelper.Peripherals.Mouse; +using GHelper.Peripherals.Mouse.Models; +using System.Runtime.CompilerServices; +using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace GHelper.Peripherals +{ + public class PeripheralsProvider + { + public static List ConnectedMice = new List(); + + public static event EventHandler? DeviceChanged; + + public static bool IsMouseConnected() + { + return ConnectedMice.Count > 0; + } + + public static void RefreshAllMice() + { + foreach (AsusMouse m in ConnectedMice) + { + m.ReadBattery(); + } + } + + public static void Disconnect(AsusMouse am) + { + ConnectedMice.Remove(am); + if (DeviceChanged is not null) + { + DeviceChanged(am, EventArgs.Empty); + } + } + + public static void Connect(AsusMouse am) + { + try + { + am.Connect(); + } + catch (IOException e) + { + Logger.WriteLine(am.GetDisplayName() + " failed to connect to device: " + e); + return; + } + + am.Disconnect += Mouse_Disconnect; + am.SynchronizeMouse(); + ConnectedMice.Add(am); + if (DeviceChanged is not null) + { + DeviceChanged(am, EventArgs.Empty); + } + } + + private static void Mouse_Disconnect(object? sender, EventArgs e) + { + if (sender is null) + { + return; + } + + AsusMouse am = (AsusMouse)sender; + ConnectedMice.Remove(am); + am.Dispose(); + } + + [MethodImpl(MethodImplOptions.Synchronized)] + public static void DetectAllAsusMice() + { + //Add one line for every supported mouse class here to support them. + DetectMouse(new ChakramX()); + DetectMouse(new ChakramXWired()); + } + + public static void DetectMouse(AsusMouse am) + { + if (am.IsDeviceConnected() && !ConnectedMice.Contains(am)) + { + Logger.WriteLine("Detected a new ROG Chakram X. Connecting..."); + Connect(am); + } + } + + public static void RegisterForDeviceEvents() + { + HidSharp.DeviceList.Local.Changed += Device_Changed; + } + + public static void UnregisterForDeviceEvents() + { + HidSharp.DeviceList.Local.Changed -= Device_Changed; + } + + private static void Device_Changed(object? sender, HidSharp.DeviceListChangedEventArgs e) + { + Logger.WriteLine("HID Device Event: Checking for new ASUS Mice"); + Task task = Task.Run((Action)DetectAllAsusMice); + } + } +} From 7dfe830dacb093d4a3d893ddc6b42b186b573ae2 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 10:53:30 +0200 Subject: [PATCH 03/34] Better disconnect handling --- app/Peripherals/Mouse/AsusMouse.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index a9dda3d3..e0ea879e 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -143,6 +143,12 @@ namespace GHelper.Peripherals.Mouse HidSharp.DeviceList.Local.Changed += Device_Changed; } + public override void Dispose() + { + HidSharp.DeviceList.Local.Changed -= Device_Changed; + base.Dispose(); + } + private void Device_Changed(object? sender, HidSharp.DeviceListChangedEventArgs e) { //Use this to validate whether the device is still connected. @@ -201,6 +207,12 @@ namespace GHelper.Peripherals.Mouse Logger.WriteLine(GetDisplayName() + ": Timeout reading packet " + e.Message); return null; } + catch (System.ObjectDisposedException e) + { + Logger.WriteLine(GetDisplayName() + ": Channel closed "); + OnDisconnect(); + return null; + } return response; @@ -655,7 +667,6 @@ namespace GHelper.Peripherals.Mouse for (int i = 0; i < DPIProfileCount(); ++i) { - Logger.WriteLine(GetDisplayName() + ": Read DPI Setting " + (i + 1) + ": " + DpiSettings[i].ToString()); } From 4ef7f5b4cb7288620bf8a383bcaf21481e2b2d00 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 10:53:59 +0200 Subject: [PATCH 04/34] Expose Dispose function for overriding --- app/AnimeMatrix/Communication/Device.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/AnimeMatrix/Communication/Device.cs b/app/AnimeMatrix/Communication/Device.cs index 93453649..9ee7a460 100644 --- a/app/AnimeMatrix/Communication/Device.cs +++ b/app/AnimeMatrix/Communication/Device.cs @@ -57,7 +57,7 @@ namespace GHelper.AnimeMatrix.Communication public void Write(byte[] data) => _usbProvider?.Write(data); - public void Dispose() + public virtual void Dispose() { _usbProvider?.Dispose(); } From d8b28368190aee39bf1bedbd5f5db859a80cf014 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 10:54:37 +0200 Subject: [PATCH 05/34] Improved connect and disconnect handling with better cleanup and less exceptions. --- app/Peripherals/PeripheralsProvider.cs | 95 +++++++++++++++++++------- 1 file changed, 72 insertions(+), 23 deletions(-) diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 30ddc3b5..5a4e6e47 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -16,41 +16,77 @@ namespace GHelper.Peripherals return ConnectedMice.Count > 0; } - public static void RefreshAllMice() + public static void RefreshBatteryForAllDevices() { - foreach (AsusMouse m in ConnectedMice) + lock (ConnectedMice) { - m.ReadBattery(); + foreach (AsusMouse m in ConnectedMice) + { + if (!m.MouseIsReady) + { + m.SynchronizeMouse(); + } + else + { + m.ReadBattery(); + } + } } + } public static void Disconnect(AsusMouse am) { - ConnectedMice.Remove(am); - if (DeviceChanged is not null) + lock (ConnectedMice) { - DeviceChanged(am, EventArgs.Empty); + ConnectedMice.Remove(am); + if (DeviceChanged is not null) + { + DeviceChanged(am, EventArgs.Empty); + } } } public static void Connect(AsusMouse am) { - try + lock (ConnectedMice) { - am.Connect(); - } - catch (IOException e) - { - Logger.WriteLine(am.GetDisplayName() + " failed to connect to device: " + e); - return; - } + if (ConnectedMice.Contains(am)) + { + //Mouse already connected; + return; + } + try + { + am.Connect(); + } + catch (IOException e) + { + Logger.WriteLine(am.GetDisplayName() + " failed to connect to device: " + e); + return; + } - am.Disconnect += Mouse_Disconnect; - am.SynchronizeMouse(); - ConnectedMice.Add(am); - if (DeviceChanged is not null) - { - DeviceChanged(am, EventArgs.Empty); + am.Disconnect += Mouse_Disconnect; + + //The Mouse might needs a few ms to register all its subdevices or the sync will fail. + //Retry 3 times. Do not call this on main thread! It would block the UI + + int tries = 0; + while (!am.MouseIsReady && tries < 3) + { + Thread.Sleep(250); + Logger.WriteLine(am.GetDisplayName() + " synchronising. Try " + (tries + 1)); + am.SynchronizeMouse(); + ++tries; + } + + ConnectedMice.Add(am); + Logger.WriteLine(am.GetDisplayName() + " added to the list: " + ConnectedMice.Count + " device are conneted."); + if (DeviceChanged is not null) + { + DeviceChanged(am, EventArgs.Empty); + } + UpdateSettingsView(); } } @@ -60,10 +96,23 @@ namespace GHelper.Peripherals { return; } + lock (ConnectedMice) + { + AsusMouse am = (AsusMouse)sender; + ConnectedMice.Remove(am); + Logger.WriteLine(am.GetDisplayName() + " reported disconnect. " + ConnectedMice.Count + " device are conneted."); + am.Dispose(); + UpdateSettingsView(); + } + } - AsusMouse am = (AsusMouse)sender; - ConnectedMice.Remove(am); - am.Dispose(); + + private static void UpdateSettingsView() + { + Program.settingsForm.Invoke(delegate + { + Program.settingsForm.VisualizePeripherals(); + }); } [MethodImpl(MethodImplOptions.Synchronized)] From df616b486da6ca9446cbd55148b0ae05c39c18aa Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 10:55:06 +0200 Subject: [PATCH 06/34] Register for device listener on startup --- app/Program.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Program.cs b/app/Program.cs index 595a7bfa..584fa61b 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -4,6 +4,7 @@ using GHelper.Gpu; using GHelper.Helpers; using GHelper.Input; using GHelper.Mode; +using GHelper.Peripherals; using Microsoft.Win32; using Ryzen; using System.Diagnostics; @@ -108,6 +109,9 @@ namespace GHelper unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(settingsForm.Handle, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE); + Task task = Task.Run((Action)PeripheralsProvider.DetectAllAsusMice); + PeripheralsProvider.RegisterForDeviceEvents(); + if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || action.Length > 0) { SettingsToggle(action); @@ -241,6 +245,7 @@ namespace GHelper static void OnExit(object sender, EventArgs e) { trayIcon.Visible = false; + PeripheralsProvider.UnregisterForDeviceEvents(); clamshellControl.UnregisterDisplayEvents(); NativeMethods.UnregisterPowerSettingNotification(unRegPowerNotify); Application.Exit(); From f9f96bd8075d3b20580ea3da7686e60241ec8780 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 11:52:31 +0200 Subject: [PATCH 07/34] Restructured to generic Interface for easier extension. --- app/Peripherals/IPeripheral.cs | 32 +++++++++++++++ app/Peripherals/Mouse/AsusMouse.cs | 56 ++++++++++++++++++++------ app/Peripherals/PeripheralsProvider.cs | 35 +++++++++++----- 3 files changed, 102 insertions(+), 21 deletions(-) create mode 100644 app/Peripherals/IPeripheral.cs diff --git a/app/Peripherals/IPeripheral.cs b/app/Peripherals/IPeripheral.cs new file mode 100644 index 00000000..93f6a57c --- /dev/null +++ b/app/Peripherals/IPeripheral.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GHelper.Peripherals +{ + public enum PeripheralType + { + Mouse, + Keyboard + } + + public interface IPeripheral + { + public bool IsDeviceReady { get; } + public bool Wireless { get; } + public int Battery { get; } + public bool Charging { get; } + + public PeripheralType DeviceType(); + + public string GetDisplayName(); + + public bool HasBattery(); + + public void SynchronizeDevice(); + + public void ReadBattery(); + } +} diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index e0ea879e..830c270c 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -86,7 +86,7 @@ namespace GHelper.Peripherals.Mouse } } - public abstract class AsusMouse : Device + public abstract class AsusMouse : Device, IPeripheral { internal const int ASUS_MOUSE_PACKET_SIZE = 65; @@ -94,7 +94,7 @@ namespace GHelper.Peripherals.Mouse private readonly string path; - public bool MouseIsReady { get; protected set; } + public bool IsDeviceReady { get; protected set; } public bool Wireless { get; protected set; } public int Battery { get; protected set; } public bool Charging { get; protected set; } @@ -153,6 +153,13 @@ namespace GHelper.Peripherals.Mouse { //Use this to validate whether the device is still connected. //If not, this will also initiate the disconnect and cleanup sequence. + CheckConnection(); + } + + //Override this for non battery devices to check whether the connection is still there + //This function should automatically disconnect the device in GHelper if the device is no longer there or the pipe is broken. + public virtual void CheckConnection() + { ReadBattery(); } @@ -219,19 +226,23 @@ namespace GHelper.Peripherals.Mouse } public abstract string GetDisplayName(); + public PeripheralType DeviceType() + { + return PeripheralType.Mouse; + } - public virtual void SynchronizeMouse() + public virtual void SynchronizeDevice() { DpiSettings = new AsusMouseDPI[DPIProfileCount()]; ReadBattery(); - if (Wireless && Battery == 0 && Charging == false) + if (HasBattery() && Battery <= 0 && Charging == false) { //Likely only the dongle connected and the mouse is either sleeping or turned off. //The mouse will not respond with proper data, but empty responses at this point - MouseIsReady = false; + IsDeviceReady = false; return; } - MouseIsReady = true; + IsDeviceReady = true; ReadProfile(); ReadDPI(); @@ -244,6 +255,11 @@ namespace GHelper.Peripherals.Mouse // Battery // ------------------------------------------------------------------------------ + public virtual bool HasBattery() + { + return true; + } + protected virtual bool HasEnergySettings() { return false; @@ -294,16 +310,32 @@ namespace GHelper.Peripherals.Mouse public void ReadBattery() { + if (!HasBattery() && !HasEnergySettings()) + { + return; + } + byte[]? response = WriteForResponse(GetBatteryReportPacket()); if (response is null) return; - Battery = ParseBattery(response); - Charging = ParseChargingState(response); - PowerOffSetting = ParsePowerOffSetting(response); - LowBatteryWarning = ParseLowBatteryWarning(response); + if (HasBattery()) + { + Battery = ParseBattery(response); + Charging = ParseChargingState(response); + + //If the device goes to standby it will not report battery state anymore. + IsDeviceReady = Battery > 0; + + Logger.WriteLine(GetDisplayName() + ": Got Battery Percentage " + Battery + "% - Charging:" + Charging); + } + + if (HasEnergySettings()) + { + PowerOffSetting = ParsePowerOffSetting(response); + LowBatteryWarning = ParseLowBatteryWarning(response); + Logger.WriteLine(GetDisplayName() + ": Got Auto Power Off: " + PowerOffSetting + " - Low Battery Warnning at: " + LowBatteryWarning + "%"); + } - Logger.WriteLine(GetDisplayName() + ": Got Battery Percentage " + Battery + "% - Charging:" + Charging); - Logger.WriteLine(GetDisplayName() + ": Got Auto Power Off: " + PowerOffSetting + " - Low Battery Warnning at: " + LowBatteryWarning + "%"); } // ------------------------------------------------------------------------------ diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 5a4e6e47..29851872 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -7,6 +7,8 @@ namespace GHelper.Peripherals { public class PeripheralsProvider { + public static object _LOCK = new object(); + public static List ConnectedMice = new List(); public static event EventHandler? DeviceChanged; @@ -16,15 +18,30 @@ namespace GHelper.Peripherals return ConnectedMice.Count > 0; } + //Expand if keyboards or other device get supported later. + public static bool IsAnyPeripheralConnect() + { + return IsMouseConnected(); + } + + public static List AllPeripherals() + { + List l = new List(); + l.AddRange(ConnectedMice); + + return l; + } + public static void RefreshBatteryForAllDevices() { - lock (ConnectedMice) + lock (_LOCK) { - foreach (AsusMouse m in ConnectedMice) + foreach (IPeripheral m in AllPeripherals()) { - if (!m.MouseIsReady) + if (!m.IsDeviceReady) { - m.SynchronizeMouse(); + //Try to sync the device if that hasn't been done yet + m.SynchronizeDevice(); } else { @@ -37,7 +54,7 @@ namespace GHelper.Peripherals public static void Disconnect(AsusMouse am) { - lock (ConnectedMice) + lock (_LOCK) { ConnectedMice.Remove(am); if (DeviceChanged is not null) @@ -49,7 +66,7 @@ namespace GHelper.Peripherals public static void Connect(AsusMouse am) { - lock (ConnectedMice) + lock (_LOCK) { if (ConnectedMice.Contains(am)) { @@ -72,11 +89,11 @@ namespace GHelper.Peripherals //Retry 3 times. Do not call this on main thread! It would block the UI int tries = 0; - while (!am.MouseIsReady && tries < 3) + while (!am.IsDeviceReady && tries < 3) { Thread.Sleep(250); Logger.WriteLine(am.GetDisplayName() + " synchronising. Try " + (tries + 1)); - am.SynchronizeMouse(); + am.SynchronizeDevice(); ++tries; } @@ -96,7 +113,7 @@ namespace GHelper.Peripherals { return; } - lock (ConnectedMice) + lock (_LOCK) { AsusMouse am = (AsusMouse)sender; ConnectedMice.Remove(am); From ab2dd4d685a48c3a2d19f980e5abfa21d10ae667 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 11:54:54 +0200 Subject: [PATCH 08/34] Added mouse icon --- app/Properties/Resources.Designer.cs | 20 ++++++++++++++++++++ app/Properties/Resources.resx | 6 ++++++ app/Resources/icons8-maus-32.png | Bin 0 -> 2247 bytes app/Resources/icons8-maus-48.png | Bin 0 -> 481 bytes 4 files changed, 26 insertions(+) create mode 100644 app/Resources/icons8-maus-32.png create mode 100644 app/Resources/icons8-maus-48.png diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index db1ad45f..387961ba 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -320,6 +320,26 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_maus_32 { + get { + object obj = ResourceManager.GetObject("icons8_maus_32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_maus_48 { + get { + object obj = ResourceManager.GetObject("icons8_maus_48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index dae79172..f36d49f1 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -256,4 +256,10 @@ ..\Resources\icons8-voltage-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-maus-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-maus-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/app/Resources/icons8-maus-32.png b/app/Resources/icons8-maus-32.png new file mode 100644 index 0000000000000000000000000000000000000000..cd252ce1507e777bb2213b0d938fe5afb2069d87 GIT binary patch literal 2247 zcmai0eOOav6u(15-2~-<2~yVWl0qW8`v_#W4F$FYVKf-&h!QW`9lNsaZuef;M;uv0C>g6$x@ha(Dh98WIic}<2nG0Z^Tp8v|5pfXb2+@)e@N)&t^0;H~>iI z+03XW8>7KYEDJYDp)31aArRL}p~c|}zQP=f>G3!RiK!e(sTxPNMy!SAMX@C|gb^@e zGz!{`1`~zYq>x(|VSc-|VF+|n=xiyZRw%((g2cdZUO0~rMX^B%snsDVvX@4TnUxgM z)3h0ZVXM{3vx;~GnFR~PVlm7Y!a`vf!w947CK|PcnW!L_#IS}8qckLLrg6dqx-`*D zB8Qej5QBpw;xw)sQ#Vl~$7d1&yAW8w7D~B)o#Y%6pSKrNDU^>#Y}XNI}@(F zAn`^t3roaIS+rgXiG=?G7USA~@4JKyIj%~)V!|2M_nD~2Fex-w2n)v4(jE!9QjI8a z8)i_;a3f}-7}e1z#=x}4fU$&uAXQ9TV^V0?*JvFOH>M!83?y=gF$TrQ#wtldhZ`7- zN?8yC#>-llv?z`KAK%r{poFndD3Cauq6yOO-WqOm6=oS;4KEG2yT3uuU1bE-xUw#V%p{@B z(O_D)b4G3$r3f8uMM*3=iz%=aiq`3HrapF1>FQiiz!UI!5f55e^%$e}__M(yk-@GT zcP}&v{7~=`H{rf3%GeF>F;}0NA@JxBVHTrf2s1IWhh&CKgz3dN0ARg^Gi7qn=Uws~$nSRpgDIKt@L|;{%**ieB4pkpNI8Ye;-Xf8%_!(i^HxpMDer=$W2BZ46 z6zc*fI#X3ORZo{IyQ6*&p?Vd~s)p-(^SA2+XuWdLOv&bpD`rY&Nt%{j@FqBO>*`K_ ze6_Ce=o$|D9OC$?-+$#gUcT5M>p0YdPhIq${3$py9Mcx{_tV<$&}Da`zDro<`(q_u za=F*IzG#w<46X86aUr;E)3<-q#}ih68nX7v-6J)bY2+)FIVbsQD4xx!*%q22eKy%w z`fSjV4ae`cz8Su&Wl6KcICXZ7;r4dl1L;>k+IjhC?3p`Jh1VABIXvxJ#gwHzuU~&H z`nS_7Z+S)TpQ9g~5qYlYy4~bh=9^RMt1NYMJ z(G^uYGH$Zg#b@1m!LpcnkpPp-acL9)aC}`43)oN<0018Rcv*C+y7=;`Z?gTOr*;h< zbt=j}?&Y*ki1zbKPWBmJa=!Qbwtr>sY64G)T zXthi-9%xU~Ir5_qTyb-x#odWoyXK6?9Gji%oQD4Ze`q_sYr=9Cl<26Mo*&J?DYLAGk(Js7R zdvS`epfB?EtK>BQ{4#OXmz~_@(|;Y5+~Tqpd1z0Uf5eU2n^AcyXMEWDIpek=h0#@A z{qF+LH>OFPUWr4TH5J{Jf$h}BPXEatur}9k@~`{sa|yM@k`nX6iK*Z@S>3A5!p1=0 z=bDQxEYHQPO}U=>>bDNq|FnvZeZjsKu%)oVL#+?UOH;Nb%_vxP>`HjkDscW~1V~t~ ze0c?x%~`14w{~`c{Fj73cCy;wTI-zmfAO0i>`~Sbd5FESD_c@eF5LC%&JLfaxcmB+ zT=6Njm8S36(Ho!wjCreCgHD6ny{L}<^WLV0xO^Ds_1ICgJ9Ns~gP$Z#Mv8}GhA3a_ z4YT0Fz_ODaxt9(tsl_t<2XsX(mYBG|=gypQEI%F32P|2R^3{a*R@eWJczKfSvzVoY F{{Z@nMVTMQmJNL`7o+$rA*$N+EV4u^1V+14F>fose@Tk^8}E=H3bCM`lS5xVX5u{Fe*@ z3qT3D1Im%LvN;y4%>x5;QThN6_yqh&)gpUpO>4p4O>=Il83!s&&Dj9LdIHAMYJM1a z`J*vgfDb$aLumkxTQrpf-~$KR&1Zq14gwm$geD*#(@;`?4{U1!DguB<&F6hX0PwB# zewejrrX7F}Ol#f1hZYsQ+`@R4=VUbiJ)aCPCsY{?z>?+l+)gcO09FJ6ISs&?AYfGk zuptOo*8q5efGrKct{@<<0oWG=>}deb1OcZSfPx_4Tmx_^2q891p!ru6lk3&XCrm%^(81>K)0k9G0`(3wUpJqX zN~U5a)NxhSngzAWi1{7=k)ZKl?~WPKcTGmk#G+`vm3QFF)SEe0Fq4O1uZxR|3%#FT XL?w>=_~pv=00000NkvXXu0mjff8@X5 literal 0 HcmV?d00001 From c1900e75ec39bed2137f2ab83abaedec0fc3b0aa Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 11:55:47 +0200 Subject: [PATCH 09/34] Helper function to tint images --- app/UI/ControlHelper.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/UI/ControlHelper.cs b/app/UI/ControlHelper.cs index 3d784f98..cfa62b72 100644 --- a/app/UI/ControlHelper.cs +++ b/app/UI/ControlHelper.cs @@ -172,4 +172,20 @@ public static class ControlHelper } + public static Image TintImage(Image image, Color tintColor) + { + var pic = new Bitmap(image); + + for (int y = 0; (y <= (pic.Height - 1)); y++) + { + for (int x = 0; (x <= (pic.Width - 1)); x++) + { + Color col = pic.GetPixel(x, y); + pic.SetPixel(x, y, Color.FromArgb(col.A, tintColor.R, tintColor.G, tintColor.B)); + } + } + + return pic; + } + } From 18384bbddcfb1a4c5618fafd28d935530a65988a Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 11:57:44 +0200 Subject: [PATCH 10/34] Added Peripherals Panel to main window (buttons have no function yet... coming soon) --- app/Properties/Strings.Designer.cs | 18 + app/Properties/Strings.resx | 6 + app/Settings.Designer.cs | 561 ++++++++++++++++++----------- app/Settings.cs | 69 ++++ 4 files changed, 441 insertions(+), 213 deletions(-) diff --git a/app/Properties/Strings.Designer.cs b/app/Properties/Strings.Designer.cs index 76e439e1..a5c19305 100644 --- a/app/Properties/Strings.Designer.cs +++ b/app/Properties/Strings.Designer.cs @@ -916,6 +916,15 @@ namespace GHelper.Properties { return ResourceManager.GetString("NoNewUpdates", resourceCulture); } } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Not Connected ähnelt. + /// + internal static string NotConnected { + get { + return ResourceManager.GetString("NotConnected", resourceCulture); + } + } /// /// Looks up a localized string similar to Open G-Helper window. @@ -980,6 +989,15 @@ namespace GHelper.Properties { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Peripherals ähnelt. + /// + internal static string Peripherals { + get { + return ResourceManager.GetString("Peripherals", resourceCulture); + } + } + /// /// Looks up a localized string similar to Picture / Gif. /// diff --git a/app/Properties/Strings.resx b/app/Properties/Strings.resx index 2675997c..aa381582 100644 --- a/app/Properties/Strings.resx +++ b/app/Properties/Strings.resx @@ -404,6 +404,9 @@ Do you still want to continue? No new updates + + Not Connected + Open G-Helper window @@ -425,6 +428,9 @@ Do you still want to continue? Mode + + Peripherals + Picture / Gif diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 17a31b32..78308abd 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -97,6 +97,14 @@ namespace GHelper labelVersion = new Label(); labelModel = new Label(); panelVersion = new Panel(); + panelPeripherals = new Panel(); + tableLayoutPeripherals = new TableLayoutPanel(); + buttonPeripheral3 = new RButton(); + buttonPeripheral2 = new RButton(); + buttonPeripheral1 = new RButton(); + panelPeripheralsTile = new Panel(); + picturePeripherals = new PictureBox(); + labelPeripherals = new Label(); panelMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); panelMatrixTitle.SuspendLayout(); @@ -125,6 +133,10 @@ namespace GHelper panelKeyboardTitle.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureKeyboard).BeginInit(); panelVersion.SuspendLayout(); + panelPeripherals.SuspendLayout(); + tableLayoutPeripherals.SuspendLayout(); + panelPeripheralsTile.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)picturePeripherals).BeginInit(); SuspendLayout(); // // panelMatrix @@ -135,11 +147,11 @@ namespace GHelper panelMatrix.Controls.Add(panelMatrixTitle); panelMatrix.Controls.Add(checkMatrix); panelMatrix.Dock = DockStyle.Top; - panelMatrix.Location = new Point(11, 898); + panelMatrix.Location = new Point(8, 675); panelMatrix.Margin = new Padding(0); panelMatrix.Name = "panelMatrix"; - panelMatrix.Padding = new Padding(20, 20, 20, 11); - panelMatrix.Size = new Size(811, 171); + panelMatrix.Padding = new Padding(15, 15, 15, 8); + panelMatrix.Size = new Size(621, 130); panelMatrix.TabIndex = 4; // // tableLayoutMatrix @@ -155,12 +167,12 @@ namespace GHelper tableLayoutMatrix.Controls.Add(comboMatrixRunning, 1, 0); tableLayoutMatrix.Controls.Add(buttonMatrix, 2, 0); tableLayoutMatrix.Dock = DockStyle.Top; - tableLayoutMatrix.Location = new Point(20, 60); - tableLayoutMatrix.Margin = new Padding(8); + tableLayoutMatrix.Location = new Point(15, 45); + tableLayoutMatrix.Margin = new Padding(6); tableLayoutMatrix.Name = "tableLayoutMatrix"; tableLayoutMatrix.RowCount = 1; tableLayoutMatrix.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - tableLayoutMatrix.Size = new Size(771, 60); + tableLayoutMatrix.Size = new Size(591, 47); tableLayoutMatrix.TabIndex = 43; // // comboMatrix @@ -170,12 +182,12 @@ namespace GHelper comboMatrix.Dock = DockStyle.Top; comboMatrix.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); comboMatrix.FormattingEnabled = true; - comboMatrix.ItemHeight = 32; + comboMatrix.ItemHeight = 25; comboMatrix.Items.AddRange(new object[] { Properties.Strings.MatrixOff, Properties.Strings.MatrixDim, Properties.Strings.MatrixMedium, Properties.Strings.MatrixBright }); - comboMatrix.Location = new Point(4, 11); - comboMatrix.Margin = new Padding(4, 11, 4, 8); + comboMatrix.Location = new Point(3, 8); + comboMatrix.Margin = new Padding(3, 8, 3, 6); comboMatrix.Name = "comboMatrix"; - comboMatrix.Size = new Size(249, 40); + comboMatrix.Size = new Size(191, 33); comboMatrix.TabIndex = 16; // // comboMatrixRunning @@ -185,12 +197,12 @@ namespace GHelper comboMatrixRunning.Dock = DockStyle.Top; comboMatrixRunning.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); comboMatrixRunning.FormattingEnabled = true; - comboMatrixRunning.ItemHeight = 32; + comboMatrixRunning.ItemHeight = 25; comboMatrixRunning.Items.AddRange(new object[] { Properties.Strings.MatrixBanner, Properties.Strings.MatrixLogo, Properties.Strings.MatrixPicture, Properties.Strings.MatrixClock, Properties.Strings.MatrixAudio }); - comboMatrixRunning.Location = new Point(261, 11); - comboMatrixRunning.Margin = new Padding(4, 11, 4, 8); + comboMatrixRunning.Location = new Point(200, 8); + comboMatrixRunning.Margin = new Padding(3, 8, 3, 6); comboMatrixRunning.Name = "comboMatrixRunning"; - comboMatrixRunning.Size = new Size(249, 40); + comboMatrixRunning.Size = new Size(191, 33); comboMatrixRunning.TabIndex = 17; // // buttonMatrix @@ -202,11 +214,11 @@ namespace GHelper buttonMatrix.Dock = DockStyle.Top; buttonMatrix.FlatAppearance.BorderSize = 0; buttonMatrix.FlatStyle = FlatStyle.Flat; - buttonMatrix.Location = new Point(518, 8); - buttonMatrix.Margin = new Padding(4, 8, 4, 8); + buttonMatrix.Location = new Point(397, 6); + buttonMatrix.Margin = new Padding(3, 6, 3, 6); buttonMatrix.Name = "buttonMatrix"; buttonMatrix.Secondary = true; - buttonMatrix.Size = new Size(249, 44); + buttonMatrix.Size = new Size(191, 33); buttonMatrix.TabIndex = 18; buttonMatrix.Text = Properties.Strings.PictureGif; buttonMatrix.UseVisualStyleBackColor = false; @@ -216,20 +228,18 @@ namespace GHelper panelMatrixTitle.Controls.Add(pictureMatrix); panelMatrixTitle.Controls.Add(labelMatrix); panelMatrixTitle.Dock = DockStyle.Top; - panelMatrixTitle.Location = new Point(20, 20); - panelMatrixTitle.Margin = new Padding(4); + panelMatrixTitle.Location = new Point(15, 15); panelMatrixTitle.Name = "panelMatrixTitle"; - panelMatrixTitle.Size = new Size(771, 40); + panelMatrixTitle.Size = new Size(591, 30); panelMatrixTitle.TabIndex = 45; // // pictureMatrix // pictureMatrix.BackgroundImage = Properties.Resources.icons8_matrix_32; pictureMatrix.BackgroundImageLayout = ImageLayout.Zoom; - pictureMatrix.Location = new Point(5, 0); - pictureMatrix.Margin = new Padding(4); + pictureMatrix.Location = new Point(4, 0); pictureMatrix.Name = "pictureMatrix"; - pictureMatrix.Size = new Size(32, 32); + pictureMatrix.Size = new Size(24, 24); pictureMatrix.TabIndex = 41; pictureMatrix.TabStop = false; // @@ -237,10 +247,10 @@ namespace GHelper // labelMatrix.AutoSize = true; labelMatrix.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelMatrix.Location = new Point(44, 0); - labelMatrix.Margin = new Padding(8, 0, 8, 0); + labelMatrix.Location = new Point(33, 0); + labelMatrix.Margin = new Padding(6, 0, 6, 0); labelMatrix.Name = "labelMatrix"; - labelMatrix.Size = new Size(170, 32); + labelMatrix.Size = new Size(128, 25); labelMatrix.TabIndex = 40; labelMatrix.Text = "Anime Matrix"; // @@ -248,10 +258,10 @@ namespace GHelper // checkMatrix.AutoSize = true; checkMatrix.ForeColor = SystemColors.GrayText; - checkMatrix.Location = new Point(27, 120); - checkMatrix.Margin = new Padding(8, 4, 8, 4); + checkMatrix.Location = new Point(20, 90); + checkMatrix.Margin = new Padding(6, 3, 6, 3); checkMatrix.Name = "checkMatrix"; - checkMatrix.Size = new Size(249, 36); + checkMatrix.Size = new Size(188, 29); checkMatrix.TabIndex = 19; checkMatrix.Text = Properties.Strings.TurnOffOnBattery; checkMatrix.UseVisualStyleBackColor = true; @@ -263,23 +273,22 @@ namespace GHelper panelBattery.Controls.Add(sliderBattery); panelBattery.Controls.Add(panelBatteryTitle); panelBattery.Dock = DockStyle.Top; - panelBattery.Location = new Point(11, 1069); + panelBattery.Location = new Point(8, 974); panelBattery.Margin = new Padding(0); panelBattery.Name = "panelBattery"; - panelBattery.Padding = new Padding(20, 20, 20, 7); - panelBattery.Size = new Size(811, 111); + panelBattery.Padding = new Padding(15, 15, 15, 5); + panelBattery.Size = new Size(621, 83); panelBattery.TabIndex = 5; // // sliderBattery // sliderBattery.AccessibleName = "Battery Charge Limit"; sliderBattery.Dock = DockStyle.Top; - sliderBattery.Location = new Point(20, 64); - sliderBattery.Margin = new Padding(4); + sliderBattery.Location = new Point(15, 48); sliderBattery.Max = 100; sliderBattery.Min = 40; sliderBattery.Name = "sliderBattery"; - sliderBattery.Size = new Size(771, 40); + sliderBattery.Size = new Size(591, 30); sliderBattery.Step = 5; sliderBattery.TabIndex = 20; sliderBattery.TabStop = false; @@ -292,20 +301,19 @@ namespace GHelper panelBatteryTitle.Controls.Add(pictureBattery); panelBatteryTitle.Controls.Add(labelBatteryTitle); panelBatteryTitle.Dock = DockStyle.Top; - panelBatteryTitle.Location = new Point(20, 20); - panelBatteryTitle.Margin = new Padding(4); + panelBatteryTitle.Location = new Point(15, 15); panelBatteryTitle.Name = "panelBatteryTitle"; - panelBatteryTitle.Padding = new Padding(0, 0, 0, 4); - panelBatteryTitle.Size = new Size(771, 44); + panelBatteryTitle.Padding = new Padding(0, 0, 0, 3); + panelBatteryTitle.Size = new Size(591, 33); panelBatteryTitle.TabIndex = 40; // // labelBattery // labelBattery.Anchor = AnchorStyles.Top | AnchorStyles.Right; - labelBattery.Location = new Point(432, 0); - labelBattery.Margin = new Padding(8, 0, 8, 0); + labelBattery.Location = new Point(337, 0); + labelBattery.Margin = new Padding(6, 0, 6, 0); labelBattery.Name = "labelBattery"; - labelBattery.Size = new Size(324, 36); + labelBattery.Size = new Size(243, 27); labelBattery.TabIndex = 39; labelBattery.Text = " "; labelBattery.TextAlign = ContentAlignment.TopRight; @@ -314,20 +322,19 @@ namespace GHelper // pictureBattery.BackgroundImage = Properties.Resources.icons8_charging_battery_32; pictureBattery.BackgroundImageLayout = ImageLayout.Zoom; - pictureBattery.Location = new Point(4, 2); - pictureBattery.Margin = new Padding(4); + pictureBattery.Location = new Point(3, 2); pictureBattery.Name = "pictureBattery"; - pictureBattery.Size = new Size(32, 32); + pictureBattery.Size = new Size(24, 24); pictureBattery.TabIndex = 38; pictureBattery.TabStop = false; // // labelBatteryTitle // labelBatteryTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelBatteryTitle.Location = new Point(43, 0); - labelBatteryTitle.Margin = new Padding(8, 0, 8, 0); + labelBatteryTitle.Location = new Point(32, 0); + labelBatteryTitle.Margin = new Padding(6, 0, 6, 0); labelBatteryTitle.Name = "labelBatteryTitle"; - labelBatteryTitle.Size = new Size(467, 32); + labelBatteryTitle.Size = new Size(350, 24); labelBatteryTitle.TabIndex = 37; labelBatteryTitle.Text = "Battery Charge Limit"; // @@ -339,11 +346,11 @@ namespace GHelper panelFooter.Controls.Add(buttonQuit); panelFooter.Controls.Add(checkStartup); panelFooter.Dock = DockStyle.Top; - panelFooter.Location = new Point(11, 1236); + panelFooter.Location = new Point(8, 1099); panelFooter.Margin = new Padding(0); panelFooter.Name = "panelFooter"; - panelFooter.Padding = new Padding(20); - panelFooter.Size = new Size(811, 92); + panelFooter.Padding = new Padding(15); + panelFooter.Size = new Size(621, 69); panelFooter.TabIndex = 7; // // buttonUpdates @@ -355,11 +362,11 @@ namespace GHelper buttonUpdates.BorderColor = Color.Transparent; buttonUpdates.BorderRadius = 2; buttonUpdates.FlatStyle = FlatStyle.Flat; - buttonUpdates.Location = new Point(412, 24); - buttonUpdates.Margin = new Padding(8, 4, 8, 4); + buttonUpdates.Location = new Point(322, 18); + buttonUpdates.Margin = new Padding(6, 3, 6, 3); buttonUpdates.Name = "buttonUpdates"; buttonUpdates.Secondary = true; - buttonUpdates.Size = new Size(180, 44); + buttonUpdates.Size = new Size(135, 33); buttonUpdates.TabIndex = 22; buttonUpdates.Text = "Updates"; buttonUpdates.UseVisualStyleBackColor = false; @@ -373,11 +380,11 @@ namespace GHelper buttonQuit.BorderColor = Color.Transparent; buttonQuit.BorderRadius = 2; buttonQuit.FlatStyle = FlatStyle.Flat; - buttonQuit.Location = new Point(606, 24); - buttonQuit.Margin = new Padding(8, 4, 8, 4); + buttonQuit.Location = new Point(467, 18); + buttonQuit.Margin = new Padding(6, 3, 6, 3); buttonQuit.Name = "buttonQuit"; buttonQuit.Secondary = true; - buttonQuit.Size = new Size(180, 44); + buttonQuit.Size = new Size(135, 33); buttonQuit.TabIndex = 23; buttonQuit.Text = Properties.Strings.Quit; buttonQuit.UseVisualStyleBackColor = false; @@ -385,10 +392,10 @@ namespace GHelper // checkStartup // checkStartup.AutoSize = true; - checkStartup.Location = new Point(27, 28); - checkStartup.Margin = new Padding(8, 4, 8, 4); + checkStartup.Location = new Point(20, 21); + checkStartup.Margin = new Padding(6, 3, 6, 3); checkStartup.Name = "checkStartup"; - checkStartup.Size = new Size(206, 36); + checkStartup.Size = new Size(157, 29); checkStartup.TabIndex = 21; checkStartup.Text = Properties.Strings.RunOnStartup; checkStartup.UseVisualStyleBackColor = true; @@ -400,11 +407,11 @@ namespace GHelper panelPerformance.Controls.Add(tablePerf); panelPerformance.Controls.Add(panelCPUTitle); panelPerformance.Dock = DockStyle.Top; - panelPerformance.Location = new Point(11, 11); + panelPerformance.Location = new Point(8, 8); panelPerformance.Margin = new Padding(0); panelPerformance.Name = "panelPerformance"; - panelPerformance.Padding = new Padding(20); - panelPerformance.Size = new Size(811, 208); + panelPerformance.Padding = new Padding(15); + panelPerformance.Size = new Size(621, 156); panelPerformance.TabIndex = 0; // // tablePerf @@ -421,12 +428,12 @@ namespace GHelper tablePerf.Controls.Add(buttonTurbo, 2, 0); tablePerf.Controls.Add(buttonFans, 3, 0); tablePerf.Dock = DockStyle.Top; - tablePerf.Location = new Point(20, 60); - tablePerf.Margin = new Padding(8, 4, 8, 4); + tablePerf.Location = new Point(15, 45); + tablePerf.Margin = new Padding(6, 3, 6, 3); tablePerf.Name = "tablePerf"; tablePerf.RowCount = 1; - tablePerf.RowStyles.Add(new RowStyle(SizeType.Absolute, 128F)); - tablePerf.Size = new Size(771, 128); + tablePerf.RowStyles.Add(new RowStyle(SizeType.Absolute, 96F)); + tablePerf.Size = new Size(591, 96); tablePerf.TabIndex = 29; // // buttonSilent @@ -443,11 +450,10 @@ namespace GHelper buttonSilent.ForeColor = SystemColors.ControlText; buttonSilent.Image = Properties.Resources.icons8_bicycle_48__1_; buttonSilent.ImageAlign = ContentAlignment.BottomCenter; - buttonSilent.Location = new Point(4, 4); - buttonSilent.Margin = new Padding(4); + buttonSilent.Location = new Point(3, 3); buttonSilent.Name = "buttonSilent"; buttonSilent.Secondary = false; - buttonSilent.Size = new Size(184, 120); + buttonSilent.Size = new Size(141, 90); buttonSilent.TabIndex = 1; buttonSilent.Text = Properties.Strings.Silent; buttonSilent.TextImageRelation = TextImageRelation.ImageAboveText; @@ -466,11 +472,10 @@ namespace GHelper buttonBalanced.ForeColor = SystemColors.ControlText; buttonBalanced.Image = Properties.Resources.icons8_fiat_500_48; buttonBalanced.ImageAlign = ContentAlignment.BottomCenter; - buttonBalanced.Location = new Point(196, 4); - buttonBalanced.Margin = new Padding(4); + buttonBalanced.Location = new Point(150, 3); buttonBalanced.Name = "buttonBalanced"; buttonBalanced.Secondary = false; - buttonBalanced.Size = new Size(184, 120); + buttonBalanced.Size = new Size(141, 90); buttonBalanced.TabIndex = 1; buttonBalanced.Text = Properties.Strings.Balanced; buttonBalanced.TextImageRelation = TextImageRelation.ImageAboveText; @@ -489,11 +494,10 @@ namespace GHelper buttonTurbo.ForeColor = SystemColors.ControlText; buttonTurbo.Image = Properties.Resources.icons8_rocket_48; buttonTurbo.ImageAlign = ContentAlignment.BottomCenter; - buttonTurbo.Location = new Point(388, 4); - buttonTurbo.Margin = new Padding(4); + buttonTurbo.Location = new Point(297, 3); buttonTurbo.Name = "buttonTurbo"; buttonTurbo.Secondary = false; - buttonTurbo.Size = new Size(184, 120); + buttonTurbo.Size = new Size(141, 90); buttonTurbo.TabIndex = 2; buttonTurbo.Text = Properties.Strings.Turbo; buttonTurbo.TextImageRelation = TextImageRelation.ImageAboveText; @@ -511,11 +515,10 @@ namespace GHelper buttonFans.FlatStyle = FlatStyle.Flat; buttonFans.Image = Properties.Resources.icons8_fan_48; buttonFans.ImageAlign = ContentAlignment.BottomCenter; - buttonFans.Location = new Point(580, 4); - buttonFans.Margin = new Padding(4); + buttonFans.Location = new Point(444, 3); buttonFans.Name = "buttonFans"; buttonFans.Secondary = true; - buttonFans.Size = new Size(187, 120); + buttonFans.Size = new Size(144, 90); buttonFans.TabIndex = 3; buttonFans.Text = Properties.Strings.FansPower; buttonFans.TextImageRelation = TextImageRelation.ImageAboveText; @@ -527,10 +530,9 @@ namespace GHelper panelCPUTitle.Controls.Add(labelPerf); panelCPUTitle.Controls.Add(labelCPUFan); panelCPUTitle.Dock = DockStyle.Top; - panelCPUTitle.Location = new Point(20, 20); - panelCPUTitle.Margin = new Padding(4); + panelCPUTitle.Location = new Point(15, 15); panelCPUTitle.Name = "panelCPUTitle"; - panelCPUTitle.Size = new Size(771, 40); + panelCPUTitle.Size = new Size(591, 30); panelCPUTitle.TabIndex = 30; // // picturePerf @@ -538,10 +540,9 @@ namespace GHelper picturePerf.BackgroundImage = Properties.Resources.icons8_gauge_32; picturePerf.BackgroundImageLayout = ImageLayout.Zoom; picturePerf.InitialImage = null; - picturePerf.Location = new Point(8, 0); - picturePerf.Margin = new Padding(4); + picturePerf.Location = new Point(6, 0); picturePerf.Name = "picturePerf"; - picturePerf.Size = new Size(32, 32); + picturePerf.Size = new Size(24, 24); picturePerf.TabIndex = 35; picturePerf.TabStop = false; // @@ -549,10 +550,10 @@ namespace GHelper // labelPerf.AutoSize = true; labelPerf.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelPerf.Location = new Point(40, 0); - labelPerf.Margin = new Padding(8, 0, 8, 0); + labelPerf.Location = new Point(30, 0); + labelPerf.Margin = new Padding(6, 0, 6, 0); labelPerf.Name = "labelPerf"; - labelPerf.Size = new Size(234, 32); + labelPerf.Size = new Size(174, 25); labelPerf.TabIndex = 0; labelPerf.Text = "Performance Mode"; // @@ -560,10 +561,10 @@ namespace GHelper // labelCPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelCPUFan.Cursor = Cursors.Hand; - labelCPUFan.Location = new Point(371, 0); - labelCPUFan.Margin = new Padding(8, 0, 8, 0); + labelCPUFan.Location = new Point(291, 0); + labelCPUFan.Margin = new Padding(6, 0, 6, 0); labelCPUFan.Name = "labelCPUFan"; - labelCPUFan.Size = new Size(400, 36); + labelCPUFan.Size = new Size(300, 27); labelCPUFan.TabIndex = 33; labelCPUFan.Text = " "; labelCPUFan.TextAlign = ContentAlignment.TopRight; @@ -576,21 +577,20 @@ namespace GHelper panelGPU.Controls.Add(tableGPU); panelGPU.Controls.Add(panelGPUTitle); panelGPU.Dock = DockStyle.Top; - panelGPU.Location = new Point(11, 219); + panelGPU.Location = new Point(8, 164); panelGPU.Margin = new Padding(0); panelGPU.Name = "panelGPU"; - panelGPU.Padding = new Padding(20, 20, 20, 0); - panelGPU.Size = new Size(811, 352); + panelGPU.Padding = new Padding(15, 15, 15, 0); + panelGPU.Size = new Size(621, 264); panelGPU.TabIndex = 1; // // labelTipGPU // labelTipGPU.Dock = DockStyle.Top; labelTipGPU.ForeColor = SystemColors.GrayText; - labelTipGPU.Location = new Point(20, 316); - labelTipGPU.Margin = new Padding(4, 0, 4, 0); + labelTipGPU.Location = new Point(15, 237); labelTipGPU.Name = "labelTipGPU"; - labelTipGPU.Size = new Size(771, 36); + labelTipGPU.Size = new Size(591, 27); labelTipGPU.TabIndex = 20; // // tableGPU @@ -609,13 +609,13 @@ namespace GHelper tableGPU.Controls.Add(buttonOptimized, 2, 0); tableGPU.Controls.Add(buttonUltimate, 2, 0); tableGPU.Dock = DockStyle.Top; - tableGPU.Location = new Point(20, 60); - tableGPU.Margin = new Padding(8, 4, 8, 4); + tableGPU.Location = new Point(15, 45); + tableGPU.Margin = new Padding(6, 3, 6, 3); tableGPU.Name = "tableGPU"; tableGPU.RowCount = 1; - tableGPU.RowStyles.Add(new RowStyle(SizeType.Absolute, 128F)); - tableGPU.RowStyles.Add(new RowStyle(SizeType.Absolute, 128F)); - tableGPU.Size = new Size(771, 256); + tableGPU.RowStyles.Add(new RowStyle(SizeType.Absolute, 96F)); + tableGPU.RowStyles.Add(new RowStyle(SizeType.Absolute, 96F)); + tableGPU.Size = new Size(591, 192); tableGPU.TabIndex = 16; // // buttonStopGPU @@ -631,11 +631,10 @@ namespace GHelper buttonStopGPU.ForeColor = SystemColors.ControlText; buttonStopGPU.Image = Properties.Resources.icons8_leaf_48; buttonStopGPU.ImageAlign = ContentAlignment.BottomCenter; - buttonStopGPU.Location = new Point(196, 4); - buttonStopGPU.Margin = new Padding(4); + buttonStopGPU.Location = new Point(150, 3); buttonStopGPU.Name = "buttonStopGPU"; buttonStopGPU.Secondary = false; - buttonStopGPU.Size = new Size(184, 120); + buttonStopGPU.Size = new Size(141, 90); buttonStopGPU.TabIndex = 4; buttonStopGPU.Text = "Stop GPU applications"; buttonStopGPU.TextImageRelation = TextImageRelation.ImageAboveText; @@ -656,11 +655,10 @@ namespace GHelper buttonEco.ForeColor = SystemColors.ControlText; buttonEco.Image = Properties.Resources.icons8_leaf_48; buttonEco.ImageAlign = ContentAlignment.BottomCenter; - buttonEco.Location = new Point(4, 4); - buttonEco.Margin = new Padding(4); + buttonEco.Location = new Point(3, 3); buttonEco.Name = "buttonEco"; buttonEco.Secondary = false; - buttonEco.Size = new Size(184, 120); + buttonEco.Size = new Size(141, 90); buttonEco.TabIndex = 4; buttonEco.Text = Properties.Strings.EcoMode; buttonEco.TextImageRelation = TextImageRelation.ImageAboveText; @@ -679,11 +677,10 @@ namespace GHelper buttonStandard.ForeColor = SystemColors.ControlText; buttonStandard.Image = Properties.Resources.icons8_spa_flower_48; buttonStandard.ImageAlign = ContentAlignment.BottomCenter; - buttonStandard.Location = new Point(388, 4); - buttonStandard.Margin = new Padding(4); + buttonStandard.Location = new Point(297, 3); buttonStandard.Name = "buttonStandard"; buttonStandard.Secondary = false; - buttonStandard.Size = new Size(184, 120); + buttonStandard.Size = new Size(141, 90); buttonStandard.TabIndex = 5; buttonStandard.Text = Properties.Strings.StandardMode; buttonStandard.TextImageRelation = TextImageRelation.ImageAboveText; @@ -701,11 +698,10 @@ namespace GHelper buttonXGM.ForeColor = SystemColors.ControlText; buttonXGM.Image = Properties.Resources.icons8_video_48; buttonXGM.ImageAlign = ContentAlignment.BottomCenter; - buttonXGM.Location = new Point(196, 132); - buttonXGM.Margin = new Padding(4); + buttonXGM.Location = new Point(150, 99); buttonXGM.Name = "buttonXGM"; buttonXGM.Secondary = false; - buttonXGM.Size = new Size(184, 120); + buttonXGM.Size = new Size(141, 90); buttonXGM.TabIndex = 8; buttonXGM.Text = "XG Mobile"; buttonXGM.TextImageRelation = TextImageRelation.ImageAboveText; @@ -724,11 +720,10 @@ namespace GHelper buttonOptimized.ForeColor = SystemColors.ControlText; buttonOptimized.Image = Properties.Resources.icons8_project_management_48__1_; buttonOptimized.ImageAlign = ContentAlignment.BottomCenter; - buttonOptimized.Location = new Point(4, 132); - buttonOptimized.Margin = new Padding(4); + buttonOptimized.Location = new Point(3, 99); buttonOptimized.Name = "buttonOptimized"; buttonOptimized.Secondary = false; - buttonOptimized.Size = new Size(184, 120); + buttonOptimized.Size = new Size(141, 90); buttonOptimized.TabIndex = 7; buttonOptimized.Text = Properties.Strings.Optimized; buttonOptimized.TextImageRelation = TextImageRelation.ImageAboveText; @@ -747,11 +742,10 @@ namespace GHelper buttonUltimate.ForeColor = SystemColors.ControlText; buttonUltimate.Image = Properties.Resources.icons8_game_controller_48; buttonUltimate.ImageAlign = ContentAlignment.BottomCenter; - buttonUltimate.Location = new Point(580, 4); - buttonUltimate.Margin = new Padding(4); + buttonUltimate.Location = new Point(444, 3); buttonUltimate.Name = "buttonUltimate"; buttonUltimate.Secondary = false; - buttonUltimate.Size = new Size(187, 120); + buttonUltimate.Size = new Size(144, 90); buttonUltimate.TabIndex = 6; buttonUltimate.Text = Properties.Strings.UltimateMode; buttonUltimate.TextImageRelation = TextImageRelation.ImageAboveText; @@ -763,20 +757,18 @@ namespace GHelper panelGPUTitle.Controls.Add(labelGPU); panelGPUTitle.Controls.Add(labelGPUFan); panelGPUTitle.Dock = DockStyle.Top; - panelGPUTitle.Location = new Point(20, 20); - panelGPUTitle.Margin = new Padding(4); + panelGPUTitle.Location = new Point(15, 15); panelGPUTitle.Name = "panelGPUTitle"; - panelGPUTitle.Size = new Size(771, 40); + panelGPUTitle.Size = new Size(591, 30); panelGPUTitle.TabIndex = 21; // // pictureGPU // pictureGPU.BackgroundImage = Properties.Resources.icons8_video_card_32; pictureGPU.BackgroundImageLayout = ImageLayout.Zoom; - pictureGPU.Location = new Point(8, 0); - pictureGPU.Margin = new Padding(4); + pictureGPU.Location = new Point(6, 0); pictureGPU.Name = "pictureGPU"; - pictureGPU.Size = new Size(32, 32); + pictureGPU.Size = new Size(24, 24); pictureGPU.TabIndex = 22; pictureGPU.TabStop = false; // @@ -784,20 +776,20 @@ namespace GHelper // labelGPU.AutoSize = true; labelGPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelGPU.Location = new Point(40, 0); - labelGPU.Margin = new Padding(8, 0, 8, 0); + labelGPU.Location = new Point(30, 0); + labelGPU.Margin = new Padding(6, 0, 6, 0); labelGPU.Name = "labelGPU"; - labelGPU.Size = new Size(136, 32); + labelGPU.Size = new Size(103, 25); labelGPU.TabIndex = 21; labelGPU.Text = "GPU Mode"; // // labelGPUFan // labelGPUFan.Anchor = AnchorStyles.Top | AnchorStyles.Right; - labelGPUFan.Location = new Point(371, 0); - labelGPUFan.Margin = new Padding(8, 0, 8, 0); + labelGPUFan.Location = new Point(291, 0); + labelGPUFan.Margin = new Padding(6, 0, 6, 0); labelGPUFan.Name = "labelGPUFan"; - labelGPUFan.Size = new Size(400, 35); + labelGPUFan.Size = new Size(300, 26); labelGPUFan.TabIndex = 20; labelGPUFan.Text = " "; labelGPUFan.TextAlign = ContentAlignment.TopRight; @@ -810,21 +802,20 @@ namespace GHelper panelScreen.Controls.Add(tableScreen); panelScreen.Controls.Add(panelScreenTitle); panelScreen.Dock = DockStyle.Top; - panelScreen.Location = new Point(11, 571); + panelScreen.Location = new Point(8, 428); panelScreen.Margin = new Padding(0); panelScreen.Name = "panelScreen"; - panelScreen.Padding = new Padding(20, 20, 20, 11); - panelScreen.Size = new Size(811, 187); + panelScreen.Padding = new Padding(15, 15, 15, 8); + panelScreen.Size = new Size(621, 140); panelScreen.TabIndex = 2; // // labelTipScreen // labelTipScreen.Dock = DockStyle.Top; labelTipScreen.ForeColor = SystemColors.GrayText; - labelTipScreen.Location = new Point(20, 140); - labelTipScreen.Margin = new Padding(4, 0, 4, 0); + labelTipScreen.Location = new Point(15, 105); labelTipScreen.Name = "labelTipScreen"; - labelTipScreen.Size = new Size(771, 36); + labelTipScreen.Size = new Size(591, 27); labelTipScreen.TabIndex = 24; // // tableScreen @@ -841,12 +832,12 @@ namespace GHelper tableScreen.Controls.Add(button120Hz, 2, 0); tableScreen.Controls.Add(buttonMiniled, 3, 0); tableScreen.Dock = DockStyle.Top; - tableScreen.Location = new Point(20, 60); - tableScreen.Margin = new Padding(8, 4, 8, 4); + tableScreen.Location = new Point(15, 45); + tableScreen.Margin = new Padding(6, 3, 6, 3); tableScreen.Name = "tableScreen"; tableScreen.RowCount = 1; - tableScreen.RowStyles.Add(new RowStyle(SizeType.Absolute, 80F)); - tableScreen.Size = new Size(771, 80); + tableScreen.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F)); + tableScreen.Size = new Size(591, 60); tableScreen.TabIndex = 23; // // buttonScreenAuto @@ -860,11 +851,10 @@ namespace GHelper buttonScreenAuto.FlatAppearance.BorderSize = 0; buttonScreenAuto.FlatStyle = FlatStyle.Flat; buttonScreenAuto.ForeColor = SystemColors.ControlText; - buttonScreenAuto.Location = new Point(4, 4); - buttonScreenAuto.Margin = new Padding(4); + buttonScreenAuto.Location = new Point(3, 3); buttonScreenAuto.Name = "buttonScreenAuto"; buttonScreenAuto.Secondary = false; - buttonScreenAuto.Size = new Size(184, 72); + buttonScreenAuto.Size = new Size(141, 54); buttonScreenAuto.TabIndex = 9; buttonScreenAuto.Text = Properties.Strings.AutoMode; buttonScreenAuto.UseVisualStyleBackColor = false; @@ -881,11 +871,10 @@ namespace GHelper button60Hz.FlatAppearance.BorderSize = 0; button60Hz.FlatStyle = FlatStyle.Flat; button60Hz.ForeColor = SystemColors.ControlText; - button60Hz.Location = new Point(196, 4); - button60Hz.Margin = new Padding(4); + button60Hz.Location = new Point(150, 3); button60Hz.Name = "button60Hz"; button60Hz.Secondary = false; - button60Hz.Size = new Size(184, 72); + button60Hz.Size = new Size(141, 54); button60Hz.TabIndex = 10; button60Hz.Text = "60Hz"; button60Hz.UseVisualStyleBackColor = false; @@ -901,11 +890,10 @@ namespace GHelper button120Hz.FlatAppearance.BorderSize = 0; button120Hz.FlatStyle = FlatStyle.Flat; button120Hz.ForeColor = SystemColors.ControlText; - button120Hz.Location = new Point(388, 4); - button120Hz.Margin = new Padding(4); + button120Hz.Location = new Point(297, 3); button120Hz.Name = "button120Hz"; button120Hz.Secondary = false; - button120Hz.Size = new Size(184, 72); + button120Hz.Size = new Size(141, 54); button120Hz.TabIndex = 11; button120Hz.Text = "120Hz + OD"; button120Hz.UseVisualStyleBackColor = false; @@ -921,11 +909,10 @@ namespace GHelper buttonMiniled.FlatAppearance.BorderSize = 0; buttonMiniled.FlatStyle = FlatStyle.Flat; buttonMiniled.ForeColor = SystemColors.ControlText; - buttonMiniled.Location = new Point(580, 4); - buttonMiniled.Margin = new Padding(4); + buttonMiniled.Location = new Point(444, 3); buttonMiniled.Name = "buttonMiniled"; buttonMiniled.Secondary = false; - buttonMiniled.Size = new Size(187, 72); + buttonMiniled.Size = new Size(144, 54); buttonMiniled.TabIndex = 12; buttonMiniled.Text = Properties.Strings.Multizone; buttonMiniled.UseVisualStyleBackColor = false; @@ -936,19 +923,18 @@ namespace GHelper panelScreenTitle.Controls.Add(pictureScreen); panelScreenTitle.Controls.Add(labelSreen); panelScreenTitle.Dock = DockStyle.Top; - panelScreenTitle.Location = new Point(20, 20); - panelScreenTitle.Margin = new Padding(4); + panelScreenTitle.Location = new Point(15, 15); panelScreenTitle.Name = "panelScreenTitle"; - panelScreenTitle.Size = new Size(771, 40); + panelScreenTitle.Size = new Size(591, 30); panelScreenTitle.TabIndex = 25; // // labelMidFan // labelMidFan.Anchor = AnchorStyles.Top | AnchorStyles.Right; - labelMidFan.Location = new Point(516, -3); - labelMidFan.Margin = new Padding(8, 0, 8, 0); + labelMidFan.Location = new Point(400, -2); + labelMidFan.Margin = new Padding(6, 0, 6, 0); labelMidFan.Name = "labelMidFan"; - labelMidFan.Size = new Size(253, 35); + labelMidFan.Size = new Size(190, 26); labelMidFan.TabIndex = 28; labelMidFan.Text = " "; labelMidFan.TextAlign = ContentAlignment.TopRight; @@ -957,10 +943,9 @@ namespace GHelper // pictureScreen.BackgroundImage = Properties.Resources.icons8_laptop_32; pictureScreen.BackgroundImageLayout = ImageLayout.Zoom; - pictureScreen.Location = new Point(5, 0); - pictureScreen.Margin = new Padding(4); + pictureScreen.Location = new Point(4, 0); pictureScreen.Name = "pictureScreen"; - pictureScreen.Size = new Size(32, 32); + pictureScreen.Size = new Size(24, 24); pictureScreen.TabIndex = 27; pictureScreen.TabStop = false; // @@ -968,10 +953,10 @@ namespace GHelper // labelSreen.AutoSize = true; labelSreen.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelSreen.Location = new Point(40, 0); - labelSreen.Margin = new Padding(8, 0, 8, 0); + labelSreen.Location = new Point(30, 0); + labelSreen.Margin = new Padding(6, 0, 6, 0); labelSreen.Name = "labelSreen"; - labelSreen.Size = new Size(176, 32); + labelSreen.Size = new Size(133, 25); labelSreen.TabIndex = 26; labelSreen.Text = "Laptop Screen"; // @@ -982,11 +967,11 @@ namespace GHelper panelKeyboard.Controls.Add(tableLayoutKeyboard); panelKeyboard.Controls.Add(panelKeyboardTitle); panelKeyboard.Dock = DockStyle.Top; - panelKeyboard.Location = new Point(11, 758); + panelKeyboard.Location = new Point(8, 568); panelKeyboard.Margin = new Padding(0); panelKeyboard.Name = "panelKeyboard"; - panelKeyboard.Padding = new Padding(20); - panelKeyboard.Size = new Size(811, 140); + panelKeyboard.Padding = new Padding(15); + panelKeyboard.Size = new Size(621, 107); panelKeyboard.TabIndex = 3; // // tableLayoutKeyboard @@ -1001,12 +986,12 @@ namespace GHelper tableLayoutKeyboard.Controls.Add(panelColor, 0, 0); tableLayoutKeyboard.Controls.Add(comboKeyboard, 0, 0); tableLayoutKeyboard.Dock = DockStyle.Top; - tableLayoutKeyboard.Location = new Point(20, 60); - tableLayoutKeyboard.Margin = new Padding(8); + tableLayoutKeyboard.Location = new Point(15, 45); + tableLayoutKeyboard.Margin = new Padding(6); tableLayoutKeyboard.Name = "tableLayoutKeyboard"; tableLayoutKeyboard.RowCount = 1; tableLayoutKeyboard.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - tableLayoutKeyboard.Size = new Size(771, 60); + tableLayoutKeyboard.Size = new Size(591, 47); tableLayoutKeyboard.TabIndex = 39; // // buttonKeyboard @@ -1021,11 +1006,11 @@ namespace GHelper buttonKeyboard.FlatStyle = FlatStyle.Flat; buttonKeyboard.Image = Properties.Resources.icons8_settings_32; buttonKeyboard.ImageAlign = ContentAlignment.MiddleRight; - buttonKeyboard.Location = new Point(518, 8); - buttonKeyboard.Margin = new Padding(4, 8, 4, 8); + buttonKeyboard.Location = new Point(397, 6); + buttonKeyboard.Margin = new Padding(3, 6, 3, 6); buttonKeyboard.Name = "buttonKeyboard"; buttonKeyboard.Secondary = true; - buttonKeyboard.Size = new Size(249, 44); + buttonKeyboard.Size = new Size(191, 33); buttonKeyboard.TabIndex = 15; buttonKeyboard.Text = Properties.Strings.Extra; buttonKeyboard.TextImageRelation = TextImageRelation.ImageBeforeText; @@ -1038,29 +1023,29 @@ namespace GHelper panelColor.Controls.Add(pictureColor); panelColor.Controls.Add(buttonKeyboardColor); panelColor.Dock = DockStyle.Fill; - panelColor.Location = new Point(261, 8); - panelColor.Margin = new Padding(4, 8, 4, 8); + panelColor.Location = new Point(200, 6); + panelColor.Margin = new Padding(3, 6, 3, 6); panelColor.Name = "panelColor"; - panelColor.Size = new Size(249, 44); + panelColor.Size = new Size(191, 35); panelColor.TabIndex = 36; // // pictureColor2 // pictureColor2.Anchor = AnchorStyles.Top | AnchorStyles.Right; - pictureColor2.Location = new Point(189, 12); - pictureColor2.Margin = new Padding(8); + pictureColor2.Location = new Point(146, 9); + pictureColor2.Margin = new Padding(6); pictureColor2.Name = "pictureColor2"; - pictureColor2.Size = new Size(20, 20); + pictureColor2.Size = new Size(15, 15); pictureColor2.TabIndex = 41; pictureColor2.TabStop = false; // // pictureColor // pictureColor.Anchor = AnchorStyles.Top | AnchorStyles.Right; - pictureColor.Location = new Point(214, 12); - pictureColor.Margin = new Padding(8); + pictureColor.Location = new Point(164, 9); + pictureColor.Margin = new Padding(6); pictureColor.Name = "pictureColor"; - pictureColor.Size = new Size(20, 20); + pictureColor.Size = new Size(15, 15); pictureColor.TabIndex = 40; pictureColor.TabStop = false; // @@ -1075,10 +1060,10 @@ namespace GHelper buttonKeyboardColor.FlatStyle = FlatStyle.Flat; buttonKeyboardColor.ForeColor = SystemColors.ControlText; buttonKeyboardColor.Location = new Point(0, 0); - buttonKeyboardColor.Margin = new Padding(4, 8, 4, 8); + buttonKeyboardColor.Margin = new Padding(3, 6, 3, 6); buttonKeyboardColor.Name = "buttonKeyboardColor"; buttonKeyboardColor.Secondary = false; - buttonKeyboardColor.Size = new Size(249, 44); + buttonKeyboardColor.Size = new Size(191, 33); buttonKeyboardColor.TabIndex = 14; buttonKeyboardColor.Text = Properties.Strings.Color; buttonKeyboardColor.UseVisualStyleBackColor = false; @@ -1092,12 +1077,12 @@ namespace GHelper comboKeyboard.FlatStyle = FlatStyle.Flat; comboKeyboard.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); comboKeyboard.FormattingEnabled = true; - comboKeyboard.ItemHeight = 32; + comboKeyboard.ItemHeight = 25; comboKeyboard.Items.AddRange(new object[] { "Static", "Breathe", "Rainbow", "Strobe" }); - comboKeyboard.Location = new Point(4, 11); - comboKeyboard.Margin = new Padding(4, 11, 4, 8); + comboKeyboard.Location = new Point(3, 8); + comboKeyboard.Margin = new Padding(3, 8, 3, 6); comboKeyboard.Name = "comboKeyboard"; - comboKeyboard.Size = new Size(249, 40); + comboKeyboard.Size = new Size(191, 33); comboKeyboard.TabIndex = 13; // // panelKeyboardTitle @@ -1105,20 +1090,18 @@ namespace GHelper panelKeyboardTitle.Controls.Add(pictureKeyboard); panelKeyboardTitle.Controls.Add(labelKeyboard); panelKeyboardTitle.Dock = DockStyle.Top; - panelKeyboardTitle.Location = new Point(20, 20); - panelKeyboardTitle.Margin = new Padding(4); + panelKeyboardTitle.Location = new Point(15, 15); panelKeyboardTitle.Name = "panelKeyboardTitle"; - panelKeyboardTitle.Size = new Size(771, 40); + panelKeyboardTitle.Size = new Size(591, 30); panelKeyboardTitle.TabIndex = 40; // // pictureKeyboard // pictureKeyboard.BackgroundImage = Properties.Resources.icons8_keyboard_32__1_; pictureKeyboard.BackgroundImageLayout = ImageLayout.Zoom; - pictureKeyboard.Location = new Point(5, 0); - pictureKeyboard.Margin = new Padding(4); + pictureKeyboard.Location = new Point(4, 0); pictureKeyboard.Name = "pictureKeyboard"; - pictureKeyboard.Size = new Size(32, 32); + pictureKeyboard.Size = new Size(24, 24); pictureKeyboard.TabIndex = 35; pictureKeyboard.TabStop = false; // @@ -1126,10 +1109,10 @@ namespace GHelper // labelKeyboard.AutoSize = true; labelKeyboard.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelKeyboard.Location = new Point(44, 0); - labelKeyboard.Margin = new Padding(8, 0, 8, 0); + labelKeyboard.Location = new Point(33, 0); + labelKeyboard.Margin = new Padding(6, 0, 6, 0); labelKeyboard.Name = "labelKeyboard"; - labelKeyboard.Size = new Size(210, 32); + labelKeyboard.Size = new Size(158, 25); labelKeyboard.TabIndex = 34; labelKeyboard.Text = "Laptop Keyboard"; // @@ -1138,10 +1121,10 @@ namespace GHelper labelVersion.Cursor = Cursors.Hand; labelVersion.Font = new Font("Segoe UI", 9F, FontStyle.Underline, GraphicsUnit.Point); labelVersion.ForeColor = SystemColors.ControlDark; - labelVersion.Location = new Point(28, 12); - labelVersion.Margin = new Padding(8, 0, 8, 0); + labelVersion.Location = new Point(21, 9); + labelVersion.Margin = new Padding(6, 0, 6, 0); labelVersion.Name = "labelVersion"; - labelVersion.Size = new Size(300, 32); + labelVersion.Size = new Size(225, 24); labelVersion.TabIndex = 37; labelVersion.Text = "v.0"; // @@ -1150,10 +1133,10 @@ namespace GHelper labelModel.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelModel.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); labelModel.ForeColor = SystemColors.ControlDark; - labelModel.Location = new Point(380, 12); - labelModel.Margin = new Padding(8, 0, 8, 0); + labelModel.Location = new Point(298, 9); + labelModel.Margin = new Padding(6, 0, 6, 0); labelModel.Name = "labelModel"; - labelModel.Size = new Size(400, 32); + labelModel.Size = new Size(300, 24); labelModel.TabIndex = 38; labelModel.TextAlign = ContentAlignment.TopRight; // @@ -1162,34 +1145,172 @@ namespace GHelper panelVersion.Controls.Add(labelVersion); panelVersion.Controls.Add(labelModel); panelVersion.Dock = DockStyle.Top; - panelVersion.Location = new Point(11, 1180); - panelVersion.Margin = new Padding(4); + panelVersion.Location = new Point(8, 1057); panelVersion.Name = "panelVersion"; - panelVersion.Size = new Size(811, 56); + panelVersion.Size = new Size(621, 42); panelVersion.TabIndex = 6; // + // panelPeripherals + // + panelPeripherals.AutoSize = true; + panelPeripherals.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelPeripherals.Controls.Add(tableLayoutPeripherals); + panelPeripherals.Controls.Add(panelPeripheralsTile); + panelPeripherals.Dock = DockStyle.Top; + panelPeripherals.Location = new Point(8, 805); + panelPeripherals.Margin = new Padding(0); + panelPeripherals.Name = "panelPeripherals"; + panelPeripherals.Padding = new Padding(15, 15, 15, 8); + panelPeripherals.Size = new Size(621, 169); + panelPeripherals.TabIndex = 4; + // + // tableLayoutPeripherals + // + tableLayoutPeripherals.AutoSize = true; + tableLayoutPeripherals.AutoSizeMode = AutoSizeMode.GrowAndShrink; + tableLayoutPeripherals.ColumnCount = 3; + tableLayoutPeripherals.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + tableLayoutPeripherals.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + tableLayoutPeripherals.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + tableLayoutPeripherals.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + tableLayoutPeripherals.Controls.Add(buttonPeripheral3, 0, 0); + tableLayoutPeripherals.Controls.Add(buttonPeripheral2, 0, 0); + tableLayoutPeripherals.Controls.Add(buttonPeripheral1, 0, 0); + tableLayoutPeripherals.Dock = DockStyle.Top; + tableLayoutPeripherals.Location = new Point(15, 45); + tableLayoutPeripherals.Margin = new Padding(6); + tableLayoutPeripherals.Name = "tableLayoutPeripherals"; + tableLayoutPeripherals.RowCount = 1; + tableLayoutPeripherals.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + tableLayoutPeripherals.Size = new Size(591, 116); + tableLayoutPeripherals.TabIndex = 43; + // + // buttonPeripheral3 + // + buttonPeripheral3.AccessibleName = "Peripheral 3"; + buttonPeripheral3.Activated = false; + buttonPeripheral3.BackColor = SystemColors.ControlLightLight; + buttonPeripheral3.BorderColor = Color.Transparent; + buttonPeripheral3.BorderRadius = 5; + buttonPeripheral3.CausesValidation = false; + buttonPeripheral3.Dock = DockStyle.Top; + buttonPeripheral3.FlatAppearance.BorderSize = 0; + buttonPeripheral3.FlatStyle = FlatStyle.Flat; + buttonPeripheral3.Font = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point); + buttonPeripheral3.ForeColor = SystemColors.ControlText; + buttonPeripheral3.Image = Properties.Resources.icons8_maus_32; + buttonPeripheral3.ImageAlign = ContentAlignment.BottomCenter; + buttonPeripheral3.Location = new Point(397, 3); + buttonPeripheral3.Name = "buttonPeripheral3"; + buttonPeripheral3.Secondary = false; + buttonPeripheral3.Size = new Size(191, 110); + buttonPeripheral3.TabIndex = 22; + buttonPeripheral3.Text = "Mouse 3"; + buttonPeripheral3.TextImageRelation = TextImageRelation.ImageAboveText; + buttonPeripheral3.UseVisualStyleBackColor = false; + // + // buttonPeripheral2 + // + buttonPeripheral2.AccessibleName = "Peripheral 2"; + buttonPeripheral2.Activated = false; + buttonPeripheral2.BackColor = SystemColors.ControlLightLight; + buttonPeripheral2.BorderColor = Color.Transparent; + buttonPeripheral2.BorderRadius = 5; + buttonPeripheral2.CausesValidation = false; + buttonPeripheral2.Dock = DockStyle.Top; + buttonPeripheral2.FlatAppearance.BorderSize = 0; + buttonPeripheral2.FlatStyle = FlatStyle.Flat; + buttonPeripheral2.Font = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point); + buttonPeripheral2.ForeColor = SystemColors.ControlText; + buttonPeripheral2.Image = Properties.Resources.icons8_maus_32; + buttonPeripheral2.ImageAlign = ContentAlignment.BottomCenter; + buttonPeripheral2.Location = new Point(200, 3); + buttonPeripheral2.Name = "buttonPeripheral2"; + buttonPeripheral2.Secondary = false; + buttonPeripheral2.Size = new Size(191, 110); + buttonPeripheral2.TabIndex = 19; + buttonPeripheral2.Text = "Mouse 2"; + buttonPeripheral2.TextImageRelation = TextImageRelation.ImageAboveText; + buttonPeripheral2.UseVisualStyleBackColor = false; + // + // buttonPeripheral1 + // + buttonPeripheral1.AccessibleName = "Peripheral 1"; + buttonPeripheral1.Activated = false; + buttonPeripheral1.BackColor = SystemColors.ControlLightLight; + buttonPeripheral1.BorderColor = Color.Transparent; + buttonPeripheral1.BorderRadius = 5; + buttonPeripheral1.CausesValidation = false; + buttonPeripheral1.Dock = DockStyle.Top; + buttonPeripheral1.FlatAppearance.BorderSize = 0; + buttonPeripheral1.FlatStyle = FlatStyle.Flat; + buttonPeripheral1.Font = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point); + buttonPeripheral1.ForeColor = SystemColors.ControlText; + buttonPeripheral1.Image = Properties.Resources.icons8_maus_32; + buttonPeripheral1.ImageAlign = ContentAlignment.BottomCenter; + buttonPeripheral1.Location = new Point(3, 3); + buttonPeripheral1.Name = "buttonPeripheral1"; + buttonPeripheral1.Secondary = false; + buttonPeripheral1.Size = new Size(191, 110); + buttonPeripheral1.TabIndex = 20; + buttonPeripheral1.Text = "Mouse 1"; + buttonPeripheral1.TextImageRelation = TextImageRelation.ImageAboveText; + buttonPeripheral1.UseVisualStyleBackColor = false; + // + // panelPeripheralsTile + // + panelPeripheralsTile.Controls.Add(picturePeripherals); + panelPeripheralsTile.Controls.Add(labelPeripherals); + panelPeripheralsTile.Dock = DockStyle.Top; + panelPeripheralsTile.Location = new Point(15, 15); + panelPeripheralsTile.Name = "panelPeripheralsTile"; + panelPeripheralsTile.Size = new Size(591, 30); + panelPeripheralsTile.TabIndex = 45; + // + // picturePeripherals + // + picturePeripherals.BackgroundImage = Properties.Resources.icons8_maus_48; + picturePeripherals.BackgroundImageLayout = ImageLayout.Zoom; + picturePeripherals.Location = new Point(4, 0); + picturePeripherals.Name = "picturePeripherals"; + picturePeripherals.Size = new Size(24, 24); + picturePeripherals.TabIndex = 41; + picturePeripherals.TabStop = false; + // + // labelPeripherals + // + labelPeripherals.AutoSize = true; + labelPeripherals.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelPeripherals.Location = new Point(33, 0); + labelPeripherals.Margin = new Padding(6, 0, 6, 0); + labelPeripherals.Name = "labelPeripherals"; + labelPeripherals.Size = new Size(106, 25); + labelPeripherals.TabIndex = 40; + labelPeripherals.Text = "Peripherals"; + // // SettingsForm // - AutoScaleDimensions = new SizeF(192F, 192F); + AutoScaleDimensions = new SizeF(144F, 144F); AutoScaleMode = AutoScaleMode.Dpi; AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; - ClientSize = new Size(833, 1320); + ClientSize = new Size(637, 1185); Controls.Add(panelFooter); Controls.Add(panelVersion); Controls.Add(panelBattery); + Controls.Add(panelPeripherals); Controls.Add(panelMatrix); Controls.Add(panelKeyboard); Controls.Add(panelScreen); Controls.Add(panelGPU); Controls.Add(panelPerformance); - Margin = new Padding(8, 4, 8, 4); + Margin = new Padding(6, 3, 6, 3); MaximizeBox = false; MdiChildrenMinimizedAnchorBottom = false; MinimizeBox = false; - MinimumSize = new Size(823, 71); + MinimumSize = new Size(623, 67); Name = "SettingsForm"; - Padding = new Padding(11); + Padding = new Padding(8); ShowIcon = false; StartPosition = FormStartPosition.CenterScreen; Text = "G-Helper"; @@ -1233,6 +1354,12 @@ namespace GHelper panelKeyboardTitle.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureKeyboard).EndInit(); panelVersion.ResumeLayout(false); + panelPeripherals.ResumeLayout(false); + panelPeripherals.PerformLayout(); + tableLayoutPeripherals.ResumeLayout(false); + panelPeripheralsTile.ResumeLayout(false); + panelPeripheralsTile.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)picturePeripherals).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -1305,5 +1432,13 @@ namespace GHelper private Label labelVersion; private Label labelModel; private RButton buttonStopGPU; + private Panel panelPeripherals; + private TableLayoutPanel tableLayoutPeripherals; + private Panel panelPeripheralsTile; + private PictureBox picturePeripherals; + private Label labelPeripherals; + private RButton buttonPeripheral2; + private RButton buttonPeripheral3; + private RButton buttonPeripheral1; } } \ No newline at end of file diff --git a/app/Settings.cs b/app/Settings.cs index ac9dbcee..efb2b9ea 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -6,6 +6,8 @@ using GHelper.Gpu; using GHelper.Helpers; using GHelper.Input; using GHelper.Mode; +using GHelper.Peripherals; +using GHelper.Peripherals.Mouse; using GHelper.UI; using System.Diagnostics; using System.Timers; @@ -71,6 +73,7 @@ namespace GHelper labelKeyboard.Text = Properties.Strings.LaptopKeyboard; labelMatrix.Text = Properties.Strings.AnimeMatrix; labelBatteryTitle.Text = Properties.Strings.BatteryChargeLimit; + labelPeripherals.Text = Properties.Strings.Peripherals; checkMatrix.Text = Properties.Strings.TurnOffOnBattery; checkStartup.Text = Properties.Strings.RunOnStartup; @@ -182,6 +185,10 @@ namespace GHelper labelBattery.MouseLeave += PanelBattery_MouseLeave; labelBatteryTitle.MouseLeave += PanelBattery_MouseLeave; + buttonPeripheral1.Click += ButtonPeripheral_Click; + buttonPeripheral2.Click += ButtonPeripheral_Click; + buttonPeripheral3.Click += ButtonPeripheral_Click; + labelModel.Text = AppConfig.GetModelShort() + (ProcessHelper.IsUserAdministrator() ? "." : ""); TopMost = AppConfig.Is("topmost"); @@ -816,6 +823,7 @@ namespace GHelper gpuTemp = $": {HardwareControl.gpuTemp}°C"; } + PeripheralsProvider.RefreshBatteryForAllDevices(); Program.settingsForm.BeginInvoke(delegate { @@ -825,6 +833,7 @@ namespace GHelper labelMidFan.Text = "Mid " + HardwareControl.midFan; if (!batteryMouseOver) labelBattery.Text = battery; + VisualizePeripherals(); }); string trayTip = "CPU" + cpuTemp + " " + HardwareControl.cpuFan; @@ -1056,6 +1065,66 @@ namespace GHelper } + public void VisualizePeripherals() + { + if (!PeripheralsProvider.IsAnyPeripheralConnect()) + { + panelPeripherals.Visible = false; + return; + } + + Button[] buttons = new Button[] { buttonPeripheral1, buttonPeripheral2, buttonPeripheral3 }; + + //we only support 4 devces for now. Who has more than 4 mice connected to the same PC anyways.... + List lp = PeripheralsProvider.AllPeripherals(); + + for (int i = 0; i < lp.Count && i < buttons.Length; ++i) + { + IPeripheral m = lp.ElementAt(i); + Button b = buttons[i]; + + if (m.IsDeviceReady) + { + b.Text = m.GetDisplayName() + "\n" + m.Battery + "%" + + (m.Charging ? "(" + Properties.Strings.Charging + ")" : ""); + } + else + { + //Mouse is either not connected or in standby + b.Text = m.GetDisplayName() + "\n(" + Properties.Strings.NotConnected + ")"; + } + + switch (m.DeviceType()) + { + case PeripheralType.Mouse: + b.Image = ControlHelper.TintImage(Properties.Resources.icons8_maus_32, b.ForeColor); + break; + + case PeripheralType.Keyboard: + b.Image = ControlHelper.TintImage(Properties.Resources.icons8_keyboard_32, b.ForeColor); + break; + } + + b.Visible = true; + } + + for (int i = lp.Count; i < buttons.Length; ++i) + { + buttons[i].Visible = false; + } + + panelPeripherals.Visible = true; + } + + private void ButtonPeripheral_Click(object? sender, EventArgs e) + { + int index = 0; + if (sender == buttonPeripheral2) index = 1; + if (sender == buttonPeripheral3) index = 2; + + //TODO: Open Configuration Panel + + } } From 890032a81b9790dfbf058d02dfbb6e6e28f6f049 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 11:58:15 +0200 Subject: [PATCH 11/34] Auto-reposition window after resize caused by detection of a new device. --- app/Settings.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Settings.cs b/app/Settings.cs index efb2b9ea..fcf25280 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -192,8 +192,15 @@ namespace GHelper labelModel.Text = AppConfig.GetModelShort() + (ProcessHelper.IsUserAdministrator() ? "." : ""); TopMost = AppConfig.Is("topmost"); + //This will auto position the window again when it resizes. Might mess with position if people drag the window somewhere else. + this.Resize += SettingsForm_Resize; SetContextMenu(); + } + private void SettingsForm_Resize(object? sender, EventArgs e) + { + Left = Screen.FromControl(this).WorkingArea.Width - 10 - Width; + Top = Screen.FromControl(this).WorkingArea.Height - 10 - Height; } private void PanelBattery_MouseEnter(object? sender, EventArgs e) From 117ffd0f62a4a5dfb6a75cba7ac30a71905366f5 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 17:54:09 +0200 Subject: [PATCH 12/34] Various fixes in the protocol. Now it is tested and works (at least with the Chakram X in Dongle mode.) --- app/Peripherals/Mouse/AsusMouse.cs | 143 ++++++++++++++++------- app/Peripherals/Mouse/Models/ChakramX.cs | 26 +++-- 2 files changed, 116 insertions(+), 53 deletions(-) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 830c270c..03283d4d 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -1,5 +1,6 @@ using GHelper.AnimeMatrix.Communication; using GHelper.AnimeMatrix.Communication.Platform; +using System; using System.Runtime.CompilerServices; using System.Text; @@ -26,7 +27,7 @@ namespace GHelper.Peripherals.Mouse CounterClockwise = 0x1 } - public enum LightingSpeed + public enum AnimationSpeed { Slow = 0x9, Medium = 0x7, @@ -36,7 +37,7 @@ namespace GHelper.Peripherals.Mouse { Static = 0x0, Breathing = 0x1, - Colorwheel = 0x2, + ColorCycle = 0x2, Rainbow = 0x3, React = 0x4, Comet = 0x5, @@ -49,7 +50,7 @@ namespace GHelper.Peripherals.Mouse { //Some Sane defaults LightingMode = LightingMode.Static; - LightingSpeed = LightingSpeed.Medium; + AnimationSpeed = AnimationSpeed.Medium; AnimationDirection = AnimationDirection.Clockwise; RandomColor = false; Brightness = 25; @@ -60,14 +61,14 @@ namespace GHelper.Peripherals.Mouse public int Brightness { get; set; } public Color RGBColor { get; set; } public bool RandomColor { get; set; } - public LightingSpeed LightingSpeed { get; set; } + public AnimationSpeed AnimationSpeed { get; set; } public AnimationDirection AnimationDirection { get; set; } public override string? ToString() { return "LightingMode: " + LightingMode + ", Color (" + RGBColor.R + ", " + RGBColor.G + ", " + RGBColor.B - + "), Brightness: " + Brightness + "%, LightingSpeed: " + LightingSpeed + ", RandomColor:" + RandomColor + ", AnimationDirection:" + AnimationDirection; + + "), Brightness: " + Brightness + "%, LightingSpeed: " + AnimationSpeed + ", RandomColor:" + RandomColor + ", AnimationDirection:" + AnimationDirection; } } @@ -105,7 +106,7 @@ namespace GHelper.Peripherals.Mouse public int DpiProfile { get; protected set; } public AsusMouseDPI[] DpiSettings { get; protected set; } public int Profile { get; protected set; } - public int PollingRate1 { get; protected set; } + public int PollingRate { get; protected set; } public bool AngleSnapping { get; protected set; } public short AngleAdjustmentDegrees { get; protected set; } @@ -260,7 +261,7 @@ namespace GHelper.Peripherals.Mouse return true; } - protected virtual bool HasEnergySettings() + public virtual bool HasEnergySettings() { return false; } @@ -307,6 +308,24 @@ namespace GHelper.Peripherals.Mouse return 0; } + protected virtual byte[] GetUpdateEnergySettingsPacket(int lowBatteryWarning, PowerOffSetting powerOff) + { + return new byte[] { 0x00, 0x51, 0x37, 0x00, 0x00, (byte)powerOff, 0x00, (byte)lowBatteryWarning }; + } + + public void SetEnergySettings(int lowBatteryWarning, PowerOffSetting powerOff) + { + if (!HasEnergySettings()) + { + return; + } + + WriteForResponse(GetUpdateEnergySettingsPacket(lowBatteryWarning, powerOff)); + + Logger.WriteLine(GetDisplayName() + ": Got Auto Power Off: " + powerOff + " - Low Battery Warnning at: " + lowBatteryWarning + "%"); + this.PowerOffSetting = powerOff; + this.LowBatteryWarning = lowBatteryWarning; + } public void ReadBattery() { @@ -343,7 +362,7 @@ namespace GHelper.Peripherals.Mouse // ------------------------------------------------------------------------------ public abstract int ProfileCount(); - protected virtual bool HasProfiles() + public virtual bool HasProfiles() { return true; } @@ -421,10 +440,6 @@ namespace GHelper.Peripherals.Mouse // Polling Rate and Angle Snapping // ------------------------------------------------------------------------------ - public int PollingRate() - { - return PollingRate1; - } public virtual bool HasAngleSnapping() { @@ -434,8 +449,9 @@ namespace GHelper.Peripherals.Mouse public abstract string PollingRateDisplayString(int pollingRate); public abstract int PollingRateCount(); + public abstract string[] PollingRateDisplayStrings(); - protected virtual bool CanSetPollingRate() + public virtual bool CanSetPollingRate() { return true; } @@ -449,9 +465,9 @@ namespace GHelper.Peripherals.Mouse { return new byte[] { 0x00, 0x51, 0x31, 0x04, 0x00, (byte)pollingRate }; } - protected virtual byte[] GetUpdateAngleSnappingPacket(bool angleSnappin) + protected virtual byte[] GetUpdateAngleSnappingPacket(bool angleSnapping) { - return new byte[] { 0x00, 0x51, 0x31, 0x06, 0x00, (byte)(AngleSnapping ? 0x01 : 0x00) }; + return new byte[] { 0x00, 0x51, 0x31, 0x06, 0x00, (byte)(angleSnapping ? 0x01 : 0x00) }; } protected virtual byte[] GetUpdateAngleAdjustmentPacket(short angleAdjustment) { @@ -482,7 +498,7 @@ namespace GHelper.Peripherals.Mouse { if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) { - return (short)(packet[19] << 8 | packet[20]); + return (short)(packet[20] << 8 | packet[19]); } return 0; @@ -498,8 +514,8 @@ namespace GHelper.Peripherals.Mouse byte[]? response = WriteForResponse(GetReadPollingRatePacket()); if (response is null) return; - PollingRate1 = ParsePollingRate(response); - Logger.WriteLine(GetDisplayName() + ": Pollingrate: " + PollingRateDisplayString(PollingRate1) + " (" + PollingRate1 + ")"); + PollingRate = ParsePollingRate(response); + Logger.WriteLine(GetDisplayName() + ": Pollingrate: " + PollingRateDisplayString(PollingRate) + " (" + PollingRate + ")"); if (HasAngleSnapping()) { @@ -525,7 +541,7 @@ namespace GHelper.Peripherals.Mouse WriteForResponse(GetUpdatePollingRatePacket(pollingRate)); Logger.WriteLine(GetDisplayName() + ": Pollingrate set to " + PollingRateDisplayString(pollingRate)); - this.PollingRate1 = pollingRate; + this.PollingRate = pollingRate; } public void SetAngleSnapping(bool angleSnapping) @@ -563,22 +579,22 @@ namespace GHelper.Peripherals.Mouse // ------------------------------------------------------------------------------ // DPI // ------------------------------------------------------------------------------ - protected abstract int DPIProfileCount(); - protected virtual bool HasDPIColors() + public abstract int DPIProfileCount(); + public virtual bool HasDPIColors() { return true; } - protected virtual bool CanChangeDPIProfile() + public virtual bool CanChangeDPIProfile() { return DPIProfileCount() > 1; } - protected virtual int MaxDPI() + public virtual int MaxDPI() { return 2000; } - protected virtual int MinDPI() + public virtual int MinDPI() { return 100; } @@ -588,8 +604,7 @@ namespace GHelper.Peripherals.Mouse return new byte[] { 0x00, 0x51, 0x31, 0x09, 0x00, (byte)profile }; } - //There is no API to read this out from the mouse. Armoury Crate also doesn't read it. - //You can however get the HID button event when you change the profile via a mouse button which tells you the profile it was set to + //profiles start to count at 1 public void SetDPIProfile(int profile) { if (!CanChangeDPIProfile()) @@ -597,14 +612,14 @@ namespace GHelper.Peripherals.Mouse return; } - if (profile >= DPIProfileCount() || profile < 0) + if (profile > DPIProfileCount() || profile < 1) { Logger.WriteLine(GetDisplayName() + ": DPI Profile:" + profile + " is invalid."); return; } //The first DPI profile is 1 - WriteForResponse(GetChangeDPIProfilePacket(profile + 1)); + WriteForResponse(GetChangeDPIProfilePacket(profile)); Logger.WriteLine(GetDisplayName() + ": DPI Profile set to " + profile); this.DpiProfile = profile; @@ -615,9 +630,8 @@ namespace GHelper.Peripherals.Mouse return new byte[] { 0x00, 0x12, 0x04, 0x02 }; } - protected virtual byte[]? GetUpdateDPIPacket(int profile) + protected virtual byte[]? GetUpdateDPIPacket(AsusMouseDPI dpi, int profile) { - AsusMouseDPI dpi = DpiSettings[profile]; if (dpi is null) { return null; @@ -630,11 +644,11 @@ namespace GHelper.Peripherals.Mouse if (HasDPIColors()) { - return new byte[] { 0x00, 0x51, 0x31, 0x00, (byte)(dpiEncoded & 0xFF), (byte)((dpiEncoded >> 8) & 0xFF), (byte)profile, dpi.Color.R, dpi.Color.G, dpi.Color.B }; + return new byte[] { 0x00, 0x51, 0x31, (byte)(profile - 1), 0x00, (byte)(dpiEncoded & 0xFF), (byte)((dpiEncoded >> 8) & 0xFF), dpi.Color.R, dpi.Color.G, dpi.Color.B }; } else { - return new byte[] { 0x00, 0x51, 0x31, 0x00, (byte)(dpiEncoded & 0xFF), (byte)((dpiEncoded >> 8) & 0xFF), (byte)profile }; + return new byte[] { 0x00, 0x51, 0x31, (byte)(profile - 1), 0x00, (byte)(dpiEncoded & 0xFF), (byte)((dpiEncoded >> 8) & 0xFF) }; } } @@ -653,9 +667,12 @@ namespace GHelper.Peripherals.Mouse DpiSettings[i] = new AsusMouseDPI(); } - int offset = 4 + (i * 4); + int offset = 5 + (i * 4); - DpiSettings[i].DPI = (uint)(packet[offset] << 8 | packet[offset + 1]) * 50 + 50; + uint b1 = packet[offset]; + uint b2 = packet[offset + 1]; + + DpiSettings[i].DPI = (uint)(b2 << 8 | b1) * 50 + 50; } } @@ -704,15 +721,15 @@ namespace GHelper.Peripherals.Mouse } - public void SetDPIForProfile(int profile) + public void SetDPIForProfile(AsusMouseDPI dpi, int profile) { - if (profile >= DPIProfileCount() || profile < 0) + if (profile > DPIProfileCount() || profile < 1) { Logger.WriteLine(GetDisplayName() + ": DPI Profile:" + profile + " is invalid."); return; } - byte[]? packet = GetUpdateDPIPacket(profile); + byte[]? packet = GetUpdateDPIPacket(dpi, profile); if (packet == null) { Logger.WriteLine(GetDisplayName() + ": DPI setting for profile " + profile + " does not exist or is invalid."); @@ -720,8 +737,9 @@ namespace GHelper.Peripherals.Mouse } WriteForResponse(packet); - Logger.WriteLine(GetDisplayName() + ": DPI for profile " + profile + " set to " + DpiSettings[profile].DPI); - this.DpiProfile = profile; + Logger.WriteLine(GetDisplayName() + ": DPI for profile " + profile + " set to " + DpiSettings[profile - 1].DPI); + //this.DpiProfile = profile; + this.DpiSettings[profile - 1] = dpi; } @@ -730,7 +748,7 @@ namespace GHelper.Peripherals.Mouse // Lift-off Distance // ------------------------------------------------------------------------------ - protected virtual bool HasLiftOffSetting() + public virtual bool HasLiftOffSetting() { return false; } @@ -788,7 +806,7 @@ namespace GHelper.Peripherals.Mouse // RGB // ------------------------------------------------------------------------------ - protected virtual bool HasRGB() + public virtual bool HasRGB() { return false; } @@ -807,11 +825,34 @@ namespace GHelper.Peripherals.Mouse } //And this if not all modes are supported - protected virtual bool IsLightingModeSupported(LightingMode lightingMode) + public virtual bool IsLightingModeSupported(LightingMode lightingMode) { return true; } + public virtual bool SupportsRandomColor(LightingMode lightingMode) + { + return lightingMode == LightingMode.Comet; + } + + public virtual bool SupportsAnimationDirection(LightingMode lightingMode) + { + return lightingMode == LightingMode.Rainbow + || lightingMode == LightingMode.Comet; + } + public virtual bool SupportsAnimationSpeed(LightingMode lightingMode) + { + return lightingMode == LightingMode.Rainbow; + } + + public virtual bool SupportsColorSetting(LightingMode lightingMode) + { + return lightingMode == LightingMode.Static + || lightingMode == LightingMode.Breathing + || lightingMode == LightingMode.Comet + || lightingMode == LightingMode.React; + } + protected virtual byte[] GetReadLightingModePacket() { return new byte[] { 0x00, 0x12, 0x03 }; @@ -836,7 +877,7 @@ namespace GHelper.Peripherals.Mouse lightingSetting.RGBColor.R, lightingSetting.RGBColor.G, lightingSetting.RGBColor.B, (byte)lightingSetting.AnimationDirection, (byte)(lightingSetting.RandomColor ? 0x01: 0x00), - (byte)lightingSetting.LightingSpeed + (byte)lightingSetting.AnimationSpeed }; } @@ -855,7 +896,7 @@ namespace GHelper.Peripherals.Mouse setting.RGBColor = Color.FromArgb(packet[7], packet[8], packet[9]); setting.AnimationDirection = (AnimationDirection)packet[10]; setting.RandomColor = packet[11] == 0x01; - setting.LightingSpeed = (LightingSpeed)packet[12]; + setting.AnimationSpeed = (AnimationSpeed)packet[12]; return setting; @@ -882,7 +923,7 @@ namespace GHelper.Peripherals.Mouse } } - public void SetLightingSettinge(LightingSetting lightingSetting) + public void SetLightingSetting(LightingSetting lightingSetting) { if (!HasRGB() || lightingSetting is null) { @@ -895,6 +936,18 @@ namespace GHelper.Peripherals.Mouse this.LightingSetting = lightingSetting; } + protected virtual byte[] GetSaveProfilePacket() + { + return new byte[] { 0x00, 0x50, 0x03 }; + } + + public void FlushSettings() + { + WriteForResponse(GetSaveProfilePacket()); + + Logger.WriteLine(GetDisplayName() + ": Settings Flushed "); + } + public override string? ToString() { return ""; diff --git a/app/Peripherals/Mouse/Models/ChakramX.cs b/app/Peripherals/Mouse/Models/ChakramX.cs index 3e01034b..425c1234 100644 --- a/app/Peripherals/Mouse/Models/ChakramX.cs +++ b/app/Peripherals/Mouse/Models/ChakramX.cs @@ -3,7 +3,7 @@ namespace GHelper.Peripherals.Mouse.Models { public class ChakramX : AsusMouse { - internal static string[] POLLING_RATES = { "250Hz", "500Hz", "1000Hz" }; + private static string[] POLLING_RATES = { "250Hz", "500Hz", "1000Hz" }; public ChakramX() : base(0x0B05, 0x1A1A, "mi_00", true) { @@ -28,6 +28,11 @@ namespace GHelper.Peripherals.Mouse.Models return "Unknown"; } + public override string[] PollingRateDisplayStrings() + { + return POLLING_RATES; + } + public override bool HasAngleSnapping() { return true; @@ -43,27 +48,27 @@ namespace GHelper.Peripherals.Mouse.Models return 5; } - protected override int DPIProfileCount() + public override int DPIProfileCount() { return 4; } - protected override int MaxDPI() + public override int MaxDPI() { - return 65_000; + return 36_000; } - protected override bool HasLiftOffSetting() + public override bool HasLiftOffSetting() { return true; } - protected override bool HasRGB() + public override bool HasRGB() { return true; } - protected override bool HasEnergySettings() + public override bool HasEnergySettings() { return true; } @@ -72,7 +77,7 @@ namespace GHelper.Peripherals.Mouse.Models public class ChakramXWired : ChakramX { - internal new static string[] POLLING_RATES = { "250Hz", "500Hz", "1000Hz", "2000Hz", "4000Hz", "8000Hz" }; + private static string[] POLLING_RATES = { "250Hz", "500Hz", "1000Hz", "2000Hz", "4000Hz", "8000Hz" }; public ChakramXWired() : base(0x1A18, false) { } @@ -91,5 +96,10 @@ namespace GHelper.Peripherals.Mouse.Models return "Unknown"; } + + public override string[] PollingRateDisplayStrings() + { + return POLLING_RATES; + } } } From e82561239689b4ae41db2267b32b334d0405a3b3 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 17:54:37 +0200 Subject: [PATCH 13/34] Disable the button if the mouse is not ready yet. --- app/Settings.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Settings.cs b/app/Settings.cs index fcf25280..0b4d9a10 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1094,11 +1094,13 @@ namespace GHelper { b.Text = m.GetDisplayName() + "\n" + m.Battery + "%" + (m.Charging ? "(" + Properties.Strings.Charging + ")" : ""); + b.Enabled = true; } else { //Mouse is either not connected or in standby b.Text = m.GetDisplayName() + "\n(" + Properties.Strings.NotConnected + ")"; + b.Enabled = false; } switch (m.DeviceType()) From 8e19dcb677166ed1cb95aed753f3a3f165ddd671 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 18:29:34 +0200 Subject: [PATCH 14/34] Notify on Battery status update --- app/Peripherals/Mouse/AsusMouse.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 03283d4d..5e5917c5 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -92,6 +92,7 @@ namespace GHelper.Peripherals.Mouse internal const int ASUS_MOUSE_PACKET_SIZE = 65; public event EventHandler? Disconnect; + public event EventHandler? BatteryUpdated; private readonly string path; @@ -346,6 +347,11 @@ namespace GHelper.Peripherals.Mouse IsDeviceReady = Battery > 0; Logger.WriteLine(GetDisplayName() + ": Got Battery Percentage " + Battery + "% - Charging:" + Charging); + + if (BatteryUpdated is not null) + { + BatteryUpdated(this, EventArgs.Empty); + } } if (HasEnergySettings()) From 5cb5b8cdaf110bb29d550c85778447b91395ed55 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 18:30:07 +0200 Subject: [PATCH 15/34] Make sure to tell the mouse to flush the settings when we changed something --- app/Peripherals/Mouse/AsusMouse.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 5e5917c5..3380f155 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -322,6 +322,7 @@ namespace GHelper.Peripherals.Mouse } WriteForResponse(GetUpdateEnergySettingsPacket(lowBatteryWarning, powerOff)); + FlushSettings(); Logger.WriteLine(GetDisplayName() + ": Got Auto Power Off: " + powerOff + " - Low Battery Warnning at: " + lowBatteryWarning + "%"); this.PowerOffSetting = powerOff; @@ -437,6 +438,7 @@ namespace GHelper.Peripherals.Mouse } WriteForResponse(GetUpdateProfilePacket(profile)); + FlushSettings(); Logger.WriteLine(GetDisplayName() + ": Profile set to " + profile); this.Profile = profile; @@ -545,6 +547,7 @@ namespace GHelper.Peripherals.Mouse } WriteForResponse(GetUpdatePollingRatePacket(pollingRate)); + FlushSettings(); Logger.WriteLine(GetDisplayName() + ": Pollingrate set to " + PollingRateDisplayString(pollingRate)); this.PollingRate = pollingRate; @@ -558,6 +561,7 @@ namespace GHelper.Peripherals.Mouse } WriteForResponse(GetUpdateAngleSnappingPacket(angleSnapping)); + FlushSettings(); Logger.WriteLine(GetDisplayName() + ": Angle Snapping set to " + angleSnapping); this.AngleSnapping = angleSnapping; @@ -577,6 +581,7 @@ namespace GHelper.Peripherals.Mouse } WriteForResponse(GetUpdateAngleAdjustmentPacket(angleAdjustment)); + FlushSettings(); Logger.WriteLine(GetDisplayName() + ": Angle Adjustment set to " + angleAdjustment); this.AngleAdjustmentDegrees = angleAdjustment; @@ -626,6 +631,7 @@ namespace GHelper.Peripherals.Mouse //The first DPI profile is 1 WriteForResponse(GetChangeDPIProfilePacket(profile)); + FlushSettings(); Logger.WriteLine(GetDisplayName() + ": DPI Profile set to " + profile); this.DpiProfile = profile; @@ -742,6 +748,7 @@ namespace GHelper.Peripherals.Mouse return; } WriteForResponse(packet); + FlushSettings(); Logger.WriteLine(GetDisplayName() + ": DPI for profile " + profile + " set to " + DpiSettings[profile - 1].DPI); //this.DpiProfile = profile; @@ -803,6 +810,7 @@ namespace GHelper.Peripherals.Mouse } WriteForResponse(GetUpdateLiftOffDistancePacket(liftOffDistance)); + FlushSettings(); Logger.WriteLine(GetDisplayName() + ": Set Liftoff Distance to " + liftOffDistance); this.LiftOffDistance = liftOffDistance; @@ -937,6 +945,7 @@ namespace GHelper.Peripherals.Mouse } WriteForResponse(GetUpdateLightingModePacket(lightingSetting)); + FlushSettings(); Logger.WriteLine(GetDisplayName() + ": Set RGB Setting " + lightingSetting.ToString()); this.LightingSetting = lightingSetting; From 5f29e98955ea34180d6e08b26ceaf165c3eb08ec Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 18:30:26 +0200 Subject: [PATCH 16/34] Fixed lighting decode --- app/Peripherals/Mouse/AsusMouse.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 3380f155..2f549a4a 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -908,9 +908,9 @@ namespace GHelper.Peripherals.Mouse setting.Brightness = packet[6]; setting.RGBColor = Color.FromArgb(packet[7], packet[8], packet[9]); - setting.AnimationDirection = (AnimationDirection)packet[10]; - setting.RandomColor = packet[11] == 0x01; - setting.AnimationSpeed = (AnimationSpeed)packet[12]; + setting.AnimationDirection = (AnimationDirection)packet[11]; + setting.RandomColor = packet[12] == 0x01; + setting.AnimationSpeed = (AnimationSpeed)packet[13]; return setting; From 378d81bafe841e60ba8a0d6d960336a70dd5741e Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 18:37:30 +0200 Subject: [PATCH 17/34] Added UI to change ASUS mouse settings. --- app/AsusMouseSettings.Designer.cs | 1045 +++++++++++++++++ app/AsusMouseSettings.cs | 569 +++++++++ app/AsusMouseSettings.resx | 120 ++ app/Properties/Resources.Designer.cs | 64 +- app/Properties/Resources.resx | 18 + app/Properties/Strings.Designer.cs | 193 ++- app/Properties/Strings.resx | 63 + .../icons8-batterie-voll-geladen-48.png | Bin 0 -> 262 bytes app/Resources/icons8-ladende-batterie-48.png | Bin 0 -> 410 bytes app/Resources/icons8-mauszeiger-50.png | Bin 0 -> 498 bytes app/Resources/lighting_dot_24.png | Bin 0 -> 2408 bytes app/Resources/lighting_dot_32.png | Bin 0 -> 2521 bytes app/Resources/lighting_dot_48.png | Bin 0 -> 3056 bytes app/Settings.cs | 26 +- 14 files changed, 2093 insertions(+), 5 deletions(-) create mode 100644 app/AsusMouseSettings.Designer.cs create mode 100644 app/AsusMouseSettings.cs create mode 100644 app/AsusMouseSettings.resx create mode 100644 app/Resources/icons8-batterie-voll-geladen-48.png create mode 100644 app/Resources/icons8-ladende-batterie-48.png create mode 100644 app/Resources/icons8-mauszeiger-50.png create mode 100644 app/Resources/lighting_dot_24.png create mode 100644 app/Resources/lighting_dot_32.png create mode 100644 app/Resources/lighting_dot_48.png diff --git a/app/AsusMouseSettings.Designer.cs b/app/AsusMouseSettings.Designer.cs new file mode 100644 index 00000000..3cbed06e --- /dev/null +++ b/app/AsusMouseSettings.Designer.cs @@ -0,0 +1,1045 @@ +namespace GHelper +{ + partial class AsusMouseSettings + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + panelProfiles = new Panel(); + comboProfile = new UI.RComboBox(); + labelProfile = new Label(); + panelPerformance = new Panel(); + panelPerformanceOther = new Panel(); + comboBoxLiftOffDistance = new UI.RComboBox(); + labelLiftOffDistance = new Label(); + labelAngleAdjustmentValue = new Label(); + sliderAngleAdjustment = new UI.Slider(); + checkBoxAngleSnapping = new CheckBox(); + comboBoxPollingRate = new UI.RComboBox(); + labelPollingRate = new Label(); + panelDPISettings = new Panel(); + sliderDPI = new UI.Slider(); + tableLayoutPanel1 = new TableLayoutPanel(); + labelMinDPI = new Label(); + labelDPIValue = new Label(); + labelMaxDPI = new Label(); + panelDPITile = new Panel(); + pictureDPIColor = new PictureBox(); + buttonDPIColor = new UI.RButton(); + labelDPI = new Label(); + tableDPI = new TableLayoutPanel(); + buttonDPI2 = new UI.RButton(); + buttonDPI1 = new UI.RButton(); + buttonDPI3 = new UI.RButton(); + buttonDPI4 = new UI.RButton(); + panelPerformanceHeader = new Panel(); + pictureKeyboard = new PictureBox(); + labelPerformance = new Label(); + panelLighting = new Panel(); + panelLightingContent = new Panel(); + comboBoxAnimationDirection = new UI.RComboBox(); + labelAnimationDirection = new Label(); + checkBoxRandomColor = new CheckBox(); + comboBoxAnimationSpeed = new UI.RComboBox(); + labelAnimationSpeed = new Label(); + pictureBoxLightingColor = new PictureBox(); + buttonLightingColor = new UI.RButton(); + comboBoxLightingMode = new UI.RComboBox(); + labelLightingMode = new Label(); + panelLightingHeader = new Panel(); + sliderBrightness = new UI.Slider(); + pictureBoxLighting = new PictureBox(); + labelLighting = new Label(); + panelEnergy = new Panel(); + labelLowBatteryWarningValue = new Label(); + comboBoxAutoPowerOff = new UI.RComboBox(); + sliderLowBatteryWarning = new UI.Slider(); + labelLowBatteryWarning = new Label(); + labelAutoPowerOff = new Label(); + panelEnergyHeader = new Panel(); + pictureBoxEnergy = new PictureBox(); + labelEnergy = new Label(); + tableLayoutProfiles = new TableLayoutPanel(); + panelBatteryState = new Panel(); + labelChargingState = new Label(); + labelBatteryState = new Label(); + pictureBoxBatteryState = new PictureBox(); + buttonSync = new UI.RButton(); + panelBottomButtons = new Panel(); + panelProfiles.SuspendLayout(); + panelPerformance.SuspendLayout(); + panelPerformanceOther.SuspendLayout(); + panelDPISettings.SuspendLayout(); + tableLayoutPanel1.SuspendLayout(); + panelDPITile.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureDPIColor).BeginInit(); + tableDPI.SuspendLayout(); + panelPerformanceHeader.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureKeyboard).BeginInit(); + panelLighting.SuspendLayout(); + panelLightingContent.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxLightingColor).BeginInit(); + panelLightingHeader.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxLighting).BeginInit(); + panelEnergy.SuspendLayout(); + panelEnergyHeader.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxEnergy).BeginInit(); + tableLayoutProfiles.SuspendLayout(); + panelBatteryState.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxBatteryState).BeginInit(); + panelBottomButtons.SuspendLayout(); + SuspendLayout(); + // + // panelProfiles + // + panelProfiles.Controls.Add(comboProfile); + panelProfiles.Controls.Add(labelProfile); + panelProfiles.Location = new Point(330, 3); + panelProfiles.MinimumSize = new Size(340, 0); + panelProfiles.Name = "panelProfiles"; + panelProfiles.Size = new Size(340, 51); + panelProfiles.TabIndex = 0; + // + // comboProfile + // + comboProfile.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + comboProfile.BorderColor = Color.White; + comboProfile.ButtonColor = Color.FromArgb(255, 255, 255); + comboProfile.DropDownStyle = ComboBoxStyle.DropDownList; + comboProfile.FlatStyle = FlatStyle.Flat; + comboProfile.FormattingEnabled = true; + comboProfile.Location = new Point(98, 10); + comboProfile.Margin = new Padding(0); + comboProfile.Name = "comboProfile"; + comboProfile.Size = new Size(228, 33); + comboProfile.TabIndex = 43; + // + // labelProfile + // + labelProfile.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; + labelProfile.AutoSize = true; + labelProfile.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelProfile.Location = new Point(3, 13); + labelProfile.Name = "labelProfile"; + labelProfile.Size = new Size(68, 25); + labelProfile.TabIndex = 41; + labelProfile.Text = "Profile"; + // + // panelPerformance + // + panelPerformance.AutoSize = true; + panelPerformance.Controls.Add(panelPerformanceOther); + panelPerformance.Controls.Add(panelDPISettings); + panelPerformance.Controls.Add(tableDPI); + panelPerformance.Controls.Add(panelPerformanceHeader); + panelPerformance.Dock = DockStyle.Top; + panelPerformance.Location = new Point(11, 68); + panelPerformance.Name = "panelPerformance"; + panelPerformance.Padding = new Padding(0, 11, 0, 25); + panelPerformance.Size = new Size(654, 401); + panelPerformance.TabIndex = 1; + // + // panelPerformanceOther + // + panelPerformanceOther.AutoSize = true; + panelPerformanceOther.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelPerformanceOther.Controls.Add(comboBoxLiftOffDistance); + panelPerformanceOther.Controls.Add(labelLiftOffDistance); + panelPerformanceOther.Controls.Add(labelAngleAdjustmentValue); + panelPerformanceOther.Controls.Add(sliderAngleAdjustment); + panelPerformanceOther.Controls.Add(checkBoxAngleSnapping); + panelPerformanceOther.Controls.Add(comboBoxPollingRate); + panelPerformanceOther.Controls.Add(labelPollingRate); + panelPerformanceOther.Dock = DockStyle.Top; + panelPerformanceOther.Location = new Point(0, 233); + panelPerformanceOther.Name = "panelPerformanceOther"; + panelPerformanceOther.Padding = new Padding(0, 11, 0, 11); + panelPerformanceOther.Size = new Size(654, 143); + panelPerformanceOther.TabIndex = 49; + // + // comboBoxLiftOffDistance + // + comboBoxLiftOffDistance.BorderColor = Color.White; + comboBoxLiftOffDistance.ButtonColor = Color.FromArgb(255, 255, 255); + comboBoxLiftOffDistance.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxLiftOffDistance.FlatStyle = FlatStyle.Flat; + comboBoxLiftOffDistance.FormattingEnabled = true; + comboBoxLiftOffDistance.Location = new Point(368, 99); + comboBoxLiftOffDistance.Margin = new Padding(16, 0, 16, 0); + comboBoxLiftOffDistance.Name = "comboBoxLiftOffDistance"; + comboBoxLiftOffDistance.Size = new Size(281, 33); + comboBoxLiftOffDistance.TabIndex = 49; + // + // labelLiftOffDistance + // + labelLiftOffDistance.Location = new Point(6, 99); + labelLiftOffDistance.Margin = new Padding(6, 0, 6, 0); + labelLiftOffDistance.Name = "labelLiftOffDistance"; + labelLiftOffDistance.Size = new Size(348, 33); + labelLiftOffDistance.TabIndex = 48; + labelLiftOffDistance.Text = "Lift Off Distance"; + // + // labelAngleAdjustmentValue + // + labelAngleAdjustmentValue.Location = new Point(598, 61); + labelAngleAdjustmentValue.Margin = new Padding(6, 0, 6, 0); + labelAngleAdjustmentValue.Name = "labelAngleAdjustmentValue"; + labelAngleAdjustmentValue.Size = new Size(48, 30); + labelAngleAdjustmentValue.TabIndex = 47; + labelAngleAdjustmentValue.Text = "0°"; + labelAngleAdjustmentValue.TextAlign = ContentAlignment.MiddleRight; + // + // sliderAngleAdjustment + // + sliderAngleAdjustment.AccessibleName = "DPI Slider"; + sliderAngleAdjustment.Location = new Point(397, 61); + sliderAngleAdjustment.Max = 20; + sliderAngleAdjustment.Min = -20; + sliderAngleAdjustment.Name = "sliderAngleAdjustment"; + sliderAngleAdjustment.Size = new Size(208, 30); + sliderAngleAdjustment.Step = 5; + sliderAngleAdjustment.TabIndex = 46; + sliderAngleAdjustment.TabStop = false; + sliderAngleAdjustment.Text = "sliderBattery"; + sliderAngleAdjustment.Value = 0; + // + // checkBoxAngleSnapping + // + checkBoxAngleSnapping.CheckAlign = ContentAlignment.MiddleRight; + checkBoxAngleSnapping.Location = new Point(6, 61); + checkBoxAngleSnapping.Margin = new Padding(6, 0, 6, 0); + checkBoxAngleSnapping.Name = "checkBoxAngleSnapping"; + checkBoxAngleSnapping.Size = new Size(384, 30); + checkBoxAngleSnapping.TabIndex = 45; + checkBoxAngleSnapping.Text = "Angle Snapping"; + checkBoxAngleSnapping.TextAlign = ContentAlignment.TopLeft; + checkBoxAngleSnapping.UseVisualStyleBackColor = true; + // + // comboBoxPollingRate + // + comboBoxPollingRate.BorderColor = Color.White; + comboBoxPollingRate.ButtonColor = Color.FromArgb(255, 255, 255); + comboBoxPollingRate.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxPollingRate.FlatStyle = FlatStyle.Flat; + comboBoxPollingRate.FormattingEnabled = true; + comboBoxPollingRate.Location = new Point(368, 8); + comboBoxPollingRate.Margin = new Padding(16, 0, 16, 0); + comboBoxPollingRate.Name = "comboBoxPollingRate"; + comboBoxPollingRate.Size = new Size(281, 33); + comboBoxPollingRate.TabIndex = 44; + // + // labelPollingRate + // + labelPollingRate.Location = new Point(6, 9); + labelPollingRate.Margin = new Padding(6, 0, 6, 0); + labelPollingRate.Name = "labelPollingRate"; + labelPollingRate.Size = new Size(348, 30); + labelPollingRate.TabIndex = 45; + labelPollingRate.Text = "Polling Rate"; + // + // panelDPISettings + // + panelDPISettings.AutoSize = true; + panelDPISettings.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelDPISettings.Controls.Add(sliderDPI); + panelDPISettings.Controls.Add(tableLayoutPanel1); + panelDPISettings.Controls.Add(panelDPITile); + panelDPISettings.Dock = DockStyle.Top; + panelDPISettings.Location = new Point(0, 137); + panelDPISettings.Name = "panelDPISettings"; + panelDPISettings.Size = new Size(654, 96); + panelDPISettings.TabIndex = 44; + // + // sliderDPI + // + sliderDPI.AccessibleName = "DPI Slider"; + sliderDPI.Dock = DockStyle.Top; + sliderDPI.Location = new Point(0, 66); + sliderDPI.Max = 35000; + sliderDPI.Min = 100; + sliderDPI.Name = "sliderDPI"; + sliderDPI.Size = new Size(654, 30); + sliderDPI.Step = 50; + sliderDPI.TabIndex = 43; + sliderDPI.TabStop = false; + sliderDPI.Text = "sliderBattery"; + sliderDPI.Value = 2000; + // + // tableLayoutPanel1 + // + tableLayoutPanel1.AutoSize = true; + tableLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink; + tableLayoutPanel1.ColumnCount = 3; + tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); + tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); + tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); + tableLayoutPanel1.Controls.Add(labelMinDPI, 0, 0); + tableLayoutPanel1.Controls.Add(labelDPIValue, 1, 0); + tableLayoutPanel1.Controls.Add(labelMaxDPI, 2, 0); + tableLayoutPanel1.Dock = DockStyle.Top; + tableLayoutPanel1.GrowStyle = TableLayoutPanelGrowStyle.FixedSize; + tableLayoutPanel1.Location = new Point(0, 40); + tableLayoutPanel1.Name = "tableLayoutPanel1"; + tableLayoutPanel1.RowCount = 1; + tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + tableLayoutPanel1.Size = new Size(654, 26); + tableLayoutPanel1.TabIndex = 47; + // + // labelMinDPI + // + labelMinDPI.ForeColor = SystemColors.GrayText; + labelMinDPI.Location = new Point(6, 0); + labelMinDPI.Margin = new Padding(6, 0, 6, 0); + labelMinDPI.Name = "labelMinDPI"; + labelMinDPI.Size = new Size(105, 26); + labelMinDPI.TabIndex = 45; + labelMinDPI.Text = "100"; + // + // labelDPIValue + // + labelDPIValue.Anchor = AnchorStyles.Top; + labelDPIValue.Location = new Point(271, 0); + labelDPIValue.Margin = new Padding(6, 0, 6, 0); + labelDPIValue.Name = "labelDPIValue"; + labelDPIValue.Size = new Size(111, 26); + labelDPIValue.TabIndex = 44; + labelDPIValue.Text = "2000"; + labelDPIValue.TextAlign = ContentAlignment.TopCenter; + // + // labelMaxDPI + // + labelMaxDPI.Anchor = AnchorStyles.Top | AnchorStyles.Right; + labelMaxDPI.ForeColor = SystemColors.GrayText; + labelMaxDPI.Location = new Point(543, 0); + labelMaxDPI.Margin = new Padding(6, 0, 6, 0); + labelMaxDPI.Name = "labelMaxDPI"; + labelMaxDPI.Size = new Size(105, 26); + labelMaxDPI.TabIndex = 46; + labelMaxDPI.Text = " 35000"; + labelMaxDPI.TextAlign = ContentAlignment.TopRight; + // + // panelDPITile + // + panelDPITile.Controls.Add(pictureDPIColor); + panelDPITile.Controls.Add(buttonDPIColor); + panelDPITile.Controls.Add(labelDPI); + panelDPITile.Dock = DockStyle.Top; + panelDPITile.Location = new Point(0, 0); + panelDPITile.Name = "panelDPITile"; + panelDPITile.Padding = new Padding(0, 5, 0, 5); + panelDPITile.Size = new Size(654, 40); + panelDPITile.TabIndex = 48; + // + // pictureDPIColor + // + pictureDPIColor.Anchor = AnchorStyles.Top | AnchorStyles.Right; + pictureDPIColor.Location = new Point(617, 11); + pictureDPIColor.Margin = new Padding(6); + pictureDPIColor.Name = "pictureDPIColor"; + pictureDPIColor.Size = new Size(15, 15); + pictureDPIColor.TabIndex = 46; + pictureDPIColor.TabStop = false; + // + // buttonDPIColor + // + buttonDPIColor.AccessibleName = "Keyboard Color"; + buttonDPIColor.Activated = false; + buttonDPIColor.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + buttonDPIColor.AutoSize = true; + buttonDPIColor.BackColor = SystemColors.ButtonHighlight; + buttonDPIColor.BorderColor = Color.Transparent; + buttonDPIColor.BorderRadius = 2; + buttonDPIColor.FlatStyle = FlatStyle.Flat; + buttonDPIColor.ForeColor = SystemColors.ControlText; + buttonDPIColor.Location = new Point(460, 1); + buttonDPIColor.Margin = new Padding(3, 6, 3, 6); + buttonDPIColor.Name = "buttonDPIColor"; + buttonDPIColor.Secondary = false; + buttonDPIColor.Size = new Size(191, 37); + buttonDPIColor.TabIndex = 45; + buttonDPIColor.Text = Properties.Strings.Color; + buttonDPIColor.UseVisualStyleBackColor = false; + // + // labelDPI + // + labelDPI.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; + labelDPI.AutoSize = true; + labelDPI.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); + labelDPI.Location = new Point(6, 5); + labelDPI.Margin = new Padding(6, 0, 6, 0); + labelDPI.Name = "labelDPI"; + labelDPI.Size = new Size(40, 25); + labelDPI.TabIndex = 34; + labelDPI.Text = "DPI"; + // + // tableDPI + // + tableDPI.AutoSize = true; + tableDPI.AutoSizeMode = AutoSizeMode.GrowAndShrink; + tableDPI.ColumnCount = 4; + tableDPI.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + tableDPI.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + tableDPI.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + tableDPI.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + tableDPI.Controls.Add(buttonDPI2, 0, 0); + tableDPI.Controls.Add(buttonDPI1, 0, 0); + tableDPI.Controls.Add(buttonDPI3, 1, 0); + tableDPI.Controls.Add(buttonDPI4, 2, 0); + tableDPI.Dock = DockStyle.Top; + tableDPI.Location = new Point(0, 41); + tableDPI.Margin = new Padding(6, 3, 6, 3); + tableDPI.Name = "tableDPI"; + tableDPI.RowCount = 1; + tableDPI.RowStyles.Add(new RowStyle(SizeType.Absolute, 96F)); + tableDPI.RowStyles.Add(new RowStyle(SizeType.Absolute, 96F)); + tableDPI.Size = new Size(654, 96); + tableDPI.TabIndex = 42; + // + // buttonDPI2 + // + buttonDPI2.AccessibleName = "DPI Setting 2"; + buttonDPI2.Activated = false; + buttonDPI2.BackColor = SystemColors.ControlLightLight; + buttonDPI2.BorderColor = Color.Transparent; + buttonDPI2.BorderRadius = 5; + buttonDPI2.Dock = DockStyle.Top; + buttonDPI2.FlatAppearance.BorderSize = 0; + buttonDPI2.FlatStyle = FlatStyle.Flat; + buttonDPI2.ForeColor = SystemColors.ControlText; + buttonDPI2.Image = Properties.Resources.lighting_dot_32; + buttonDPI2.ImageAlign = ContentAlignment.BottomCenter; + buttonDPI2.Location = new Point(166, 3); + buttonDPI2.Name = "buttonDPI2"; + buttonDPI2.Secondary = false; + buttonDPI2.Size = new Size(157, 90); + buttonDPI2.TabIndex = 4; + buttonDPI2.Text = "DPI 2\r\n1000"; + buttonDPI2.TextImageRelation = TextImageRelation.ImageAboveText; + buttonDPI2.UseVisualStyleBackColor = false; + // + // buttonDPI1 + // + buttonDPI1.AccessibleName = "DPI Setting 1"; + buttonDPI1.Activated = false; + buttonDPI1.BackColor = SystemColors.ControlLightLight; + buttonDPI1.BorderColor = Color.Transparent; + buttonDPI1.BorderRadius = 5; + buttonDPI1.CausesValidation = false; + buttonDPI1.Dock = DockStyle.Top; + buttonDPI1.FlatAppearance.BorderSize = 0; + buttonDPI1.FlatStyle = FlatStyle.Flat; + buttonDPI1.ForeColor = SystemColors.ControlText; + buttonDPI1.Image = Properties.Resources.lighting_dot_32; + buttonDPI1.Location = new Point(3, 3); + buttonDPI1.Name = "buttonDPI1"; + buttonDPI1.Secondary = false; + buttonDPI1.Size = new Size(157, 90); + buttonDPI1.TabIndex = 4; + buttonDPI1.Text = "DPI 1\r\n800"; + buttonDPI1.TextImageRelation = TextImageRelation.ImageAboveText; + buttonDPI1.UseVisualStyleBackColor = false; + // + // buttonDPI3 + // + buttonDPI3.AccessibleName = "DPI Setting 3"; + buttonDPI3.Activated = false; + buttonDPI3.BackColor = SystemColors.ControlLightLight; + buttonDPI3.BorderColor = Color.Transparent; + buttonDPI3.BorderRadius = 5; + buttonDPI3.Dock = DockStyle.Top; + buttonDPI3.FlatAppearance.BorderSize = 0; + buttonDPI3.FlatStyle = FlatStyle.Flat; + buttonDPI3.ForeColor = SystemColors.ControlText; + buttonDPI3.Image = Properties.Resources.lighting_dot_32; + buttonDPI3.ImageAlign = ContentAlignment.BottomCenter; + buttonDPI3.Location = new Point(329, 3); + buttonDPI3.Name = "buttonDPI3"; + buttonDPI3.Secondary = false; + buttonDPI3.Size = new Size(157, 90); + buttonDPI3.TabIndex = 5; + buttonDPI3.Text = "DPI 3\r\n1200"; + buttonDPI3.TextImageRelation = TextImageRelation.ImageAboveText; + buttonDPI3.UseVisualStyleBackColor = false; + // + // buttonDPI4 + // + buttonDPI4.AccessibleName = "DPI Setting 4"; + buttonDPI4.Activated = false; + buttonDPI4.BackColor = SystemColors.ControlLightLight; + buttonDPI4.BorderColor = Color.Transparent; + buttonDPI4.BorderRadius = 5; + buttonDPI4.Dock = DockStyle.Top; + buttonDPI4.FlatAppearance.BorderSize = 0; + buttonDPI4.FlatStyle = FlatStyle.Flat; + buttonDPI4.ForeColor = SystemColors.ControlText; + buttonDPI4.Image = Properties.Resources.lighting_dot_32; + buttonDPI4.ImageAlign = ContentAlignment.BottomCenter; + buttonDPI4.Location = new Point(492, 3); + buttonDPI4.Name = "buttonDPI4"; + buttonDPI4.Secondary = false; + buttonDPI4.Size = new Size(159, 90); + buttonDPI4.TabIndex = 6; + buttonDPI4.Text = "DPI 4\r\n1400"; + buttonDPI4.TextImageRelation = TextImageRelation.ImageAboveText; + buttonDPI4.UseVisualStyleBackColor = false; + // + // panelPerformanceHeader + // + panelPerformanceHeader.BackColor = SystemColors.ControlLight; + panelPerformanceHeader.Controls.Add(pictureKeyboard); + panelPerformanceHeader.Controls.Add(labelPerformance); + panelPerformanceHeader.Dock = DockStyle.Top; + panelPerformanceHeader.Location = new Point(0, 11); + panelPerformanceHeader.Name = "panelPerformanceHeader"; + panelPerformanceHeader.Size = new Size(654, 30); + panelPerformanceHeader.TabIndex = 41; + // + // pictureKeyboard + // + pictureKeyboard.BackgroundImage = Properties.Resources.icons8_mauszeiger_50; + pictureKeyboard.BackgroundImageLayout = ImageLayout.Zoom; + pictureKeyboard.Location = new Point(4, 0); + pictureKeyboard.Name = "pictureKeyboard"; + pictureKeyboard.Size = new Size(24, 24); + pictureKeyboard.TabIndex = 35; + pictureKeyboard.TabStop = false; + // + // labelPerformance + // + labelPerformance.AutoSize = true; + labelPerformance.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelPerformance.Location = new Point(33, 0); + labelPerformance.Margin = new Padding(6, 0, 6, 0); + labelPerformance.Name = "labelPerformance"; + labelPerformance.Size = new Size(120, 25); + labelPerformance.TabIndex = 34; + labelPerformance.Text = "Performance"; + // + // panelLighting + // + panelLighting.AutoSize = true; + panelLighting.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelLighting.Controls.Add(panelLightingContent); + panelLighting.Controls.Add(panelLightingHeader); + panelLighting.Dock = DockStyle.Top; + panelLighting.Location = new Point(11, 469); + panelLighting.Name = "panelLighting"; + panelLighting.Padding = new Padding(0, 0, 0, 25); + panelLighting.Size = new Size(654, 271); + panelLighting.TabIndex = 42; + // + // panelLightingContent + // + panelLightingContent.AutoSize = true; + panelLightingContent.Controls.Add(comboBoxAnimationDirection); + panelLightingContent.Controls.Add(labelAnimationDirection); + panelLightingContent.Controls.Add(checkBoxRandomColor); + panelLightingContent.Controls.Add(comboBoxAnimationSpeed); + panelLightingContent.Controls.Add(labelAnimationSpeed); + panelLightingContent.Controls.Add(pictureBoxLightingColor); + panelLightingContent.Controls.Add(buttonLightingColor); + panelLightingContent.Controls.Add(comboBoxLightingMode); + panelLightingContent.Controls.Add(labelLightingMode); + panelLightingContent.Dock = DockStyle.Top; + panelLightingContent.Location = new Point(0, 30); + panelLightingContent.Name = "panelLightingContent"; + panelLightingContent.Padding = new Padding(0, 0, 0, 11); + panelLightingContent.Size = new Size(654, 216); + panelLightingContent.TabIndex = 42; + // + // comboBoxAnimationDirection + // + comboBoxAnimationDirection.BorderColor = Color.White; + comboBoxAnimationDirection.ButtonColor = Color.FromArgb(255, 255, 255); + comboBoxAnimationDirection.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxAnimationDirection.FlatStyle = FlatStyle.Flat; + comboBoxAnimationDirection.FormattingEnabled = true; + comboBoxAnimationDirection.Location = new Point(366, 172); + comboBoxAnimationDirection.Margin = new Padding(16, 0, 16, 0); + comboBoxAnimationDirection.Name = "comboBoxAnimationDirection"; + comboBoxAnimationDirection.Size = new Size(284, 33); + comboBoxAnimationDirection.TabIndex = 54; + // + // labelAnimationDirection + // + labelAnimationDirection.Location = new Point(6, 172); + labelAnimationDirection.Margin = new Padding(6, 0, 6, 0); + labelAnimationDirection.Name = "labelAnimationDirection"; + labelAnimationDirection.Size = new Size(316, 33); + labelAnimationDirection.TabIndex = 55; + labelAnimationDirection.Text = "Animation Direction"; + // + // checkBoxRandomColor + // + checkBoxRandomColor.Location = new Point(520, 53); + checkBoxRandomColor.Margin = new Padding(6, 0, 6, 0); + checkBoxRandomColor.Name = "checkBoxRandomColor"; + checkBoxRandomColor.Size = new Size(128, 37); + checkBoxRandomColor.TabIndex = 53; + checkBoxRandomColor.Text = "Random"; + checkBoxRandomColor.UseVisualStyleBackColor = true; + // + // comboBoxAnimationSpeed + // + comboBoxAnimationSpeed.BorderColor = Color.White; + comboBoxAnimationSpeed.ButtonColor = Color.FromArgb(255, 255, 255); + comboBoxAnimationSpeed.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxAnimationSpeed.FlatStyle = FlatStyle.Flat; + comboBoxAnimationSpeed.FormattingEnabled = true; + comboBoxAnimationSpeed.Location = new Point(366, 130); + comboBoxAnimationSpeed.Margin = new Padding(16, 0, 16, 0); + comboBoxAnimationSpeed.Name = "comboBoxAnimationSpeed"; + comboBoxAnimationSpeed.Size = new Size(284, 33); + comboBoxAnimationSpeed.TabIndex = 51; + // + // labelAnimationSpeed + // + labelAnimationSpeed.Location = new Point(6, 130); + labelAnimationSpeed.Margin = new Padding(6, 0, 6, 0); + labelAnimationSpeed.Name = "labelAnimationSpeed"; + labelAnimationSpeed.Size = new Size(316, 33); + labelAnimationSpeed.TabIndex = 52; + labelAnimationSpeed.Text = "Animation Speed"; + // + // pictureBoxLightingColor + // + pictureBoxLightingColor.Anchor = AnchorStyles.Top | AnchorStyles.Right; + pictureBoxLightingColor.Location = new Point(480, 62); + pictureBoxLightingColor.Margin = new Padding(6); + pictureBoxLightingColor.Name = "pictureBoxLightingColor"; + pictureBoxLightingColor.Size = new Size(20, 20); + pictureBoxLightingColor.TabIndex = 50; + pictureBoxLightingColor.TabStop = false; + // + // buttonLightingColor + // + buttonLightingColor.AccessibleName = "Keyboard Color"; + buttonLightingColor.Activated = false; + buttonLightingColor.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonLightingColor.BackColor = SystemColors.ButtonHighlight; + buttonLightingColor.BorderColor = Color.Transparent; + buttonLightingColor.BorderRadius = 2; + buttonLightingColor.FlatStyle = FlatStyle.Flat; + buttonLightingColor.ForeColor = SystemColors.ControlText; + buttonLightingColor.Location = new Point(373, 53); + buttonLightingColor.Margin = new Padding(3, 6, 3, 6); + buttonLightingColor.Name = "buttonLightingColor"; + buttonLightingColor.Secondary = false; + buttonLightingColor.Size = new Size(141, 37); + buttonLightingColor.TabIndex = 49; + buttonLightingColor.Text = Properties.Strings.Color; + buttonLightingColor.TextAlign = ContentAlignment.MiddleLeft; + buttonLightingColor.UseVisualStyleBackColor = false; + // + // comboBoxLightingMode + // + comboBoxLightingMode.BorderColor = Color.White; + comboBoxLightingMode.ButtonColor = Color.FromArgb(255, 255, 255); + comboBoxLightingMode.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxLightingMode.FlatStyle = FlatStyle.Flat; + comboBoxLightingMode.FormattingEnabled = true; + comboBoxLightingMode.Location = new Point(367, 14); + comboBoxLightingMode.Margin = new Padding(16, 0, 16, 0); + comboBoxLightingMode.Name = "comboBoxLightingMode"; + comboBoxLightingMode.Size = new Size(284, 33); + comboBoxLightingMode.TabIndex = 46; + // + // labelLightingMode + // + labelLightingMode.Location = new Point(7, 14); + labelLightingMode.Margin = new Padding(6, 0, 6, 0); + labelLightingMode.Name = "labelLightingMode"; + labelLightingMode.Size = new Size(316, 33); + labelLightingMode.TabIndex = 47; + labelLightingMode.Text = "Lighting Mode"; + // + // panelLightingHeader + // + panelLightingHeader.BackColor = SystemColors.ControlLight; + panelLightingHeader.Controls.Add(sliderBrightness); + panelLightingHeader.Controls.Add(pictureBoxLighting); + panelLightingHeader.Controls.Add(labelLighting); + panelLightingHeader.Dock = DockStyle.Top; + panelLightingHeader.Location = new Point(0, 0); + panelLightingHeader.Name = "panelLightingHeader"; + panelLightingHeader.Size = new Size(654, 30); + panelLightingHeader.TabIndex = 41; + // + // sliderBrightness + // + sliderBrightness.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + sliderBrightness.Location = new Point(367, 1); + sliderBrightness.Margin = new Padding(2); + sliderBrightness.Max = 100; + sliderBrightness.Min = 0; + sliderBrightness.Name = "sliderBrightness"; + sliderBrightness.Size = new Size(283, 27); + sliderBrightness.Step = 1; + sliderBrightness.TabIndex = 51; + sliderBrightness.Text = "sliderBrightness"; + sliderBrightness.Value = 25; + // + // pictureBoxLighting + // + pictureBoxLighting.BackgroundImage = Properties.Resources.backlight; + pictureBoxLighting.BackgroundImageLayout = ImageLayout.Zoom; + pictureBoxLighting.Location = new Point(4, 0); + pictureBoxLighting.Name = "pictureBoxLighting"; + pictureBoxLighting.Size = new Size(24, 24); + pictureBoxLighting.TabIndex = 35; + pictureBoxLighting.TabStop = false; + // + // labelLighting + // + labelLighting.AutoSize = true; + labelLighting.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelLighting.Location = new Point(33, 0); + labelLighting.Margin = new Padding(6, 0, 6, 0); + labelLighting.Name = "labelLighting"; + labelLighting.Size = new Size(82, 25); + labelLighting.TabIndex = 34; + labelLighting.Text = "Lighting"; + // + // panelEnergy + // + panelEnergy.AutoSize = true; + panelEnergy.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelEnergy.Controls.Add(labelLowBatteryWarningValue); + panelEnergy.Controls.Add(comboBoxAutoPowerOff); + panelEnergy.Controls.Add(sliderLowBatteryWarning); + panelEnergy.Controls.Add(labelLowBatteryWarning); + panelEnergy.Controls.Add(labelAutoPowerOff); + panelEnergy.Controls.Add(panelEnergyHeader); + panelEnergy.Dock = DockStyle.Top; + panelEnergy.Location = new Point(11, 740); + panelEnergy.Name = "panelEnergy"; + panelEnergy.Padding = new Padding(0, 0, 0, 25); + panelEnergy.Size = new Size(654, 143); + panelEnergy.TabIndex = 43; + // + // labelLowBatteryWarningValue + // + labelLowBatteryWarningValue.Location = new Point(601, 85); + labelLowBatteryWarningValue.Margin = new Padding(6, 0, 6, 0); + labelLowBatteryWarningValue.Name = "labelLowBatteryWarningValue"; + labelLowBatteryWarningValue.Size = new Size(48, 30); + labelLowBatteryWarningValue.TabIndex = 51; + labelLowBatteryWarningValue.Text = "20%"; + labelLowBatteryWarningValue.TextAlign = ContentAlignment.MiddleRight; + // + // comboBoxAutoPowerOff + // + comboBoxAutoPowerOff.BorderColor = Color.White; + comboBoxAutoPowerOff.ButtonColor = Color.FromArgb(255, 255, 255); + comboBoxAutoPowerOff.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxAutoPowerOff.FlatStyle = FlatStyle.Flat; + comboBoxAutoPowerOff.FormattingEnabled = true; + comboBoxAutoPowerOff.Location = new Point(362, 43); + comboBoxAutoPowerOff.Margin = new Padding(16, 0, 16, 0); + comboBoxAutoPowerOff.Name = "comboBoxAutoPowerOff"; + comboBoxAutoPowerOff.Size = new Size(284, 33); + comboBoxAutoPowerOff.TabIndex = 56; + // + // sliderLowBatteryWarning + // + sliderLowBatteryWarning.AccessibleName = "DPI Slider"; + sliderLowBatteryWarning.Location = new Point(362, 85); + sliderLowBatteryWarning.Max = 50; + sliderLowBatteryWarning.Min = 0; + sliderLowBatteryWarning.Name = "sliderLowBatteryWarning"; + sliderLowBatteryWarning.Size = new Size(243, 30); + sliderLowBatteryWarning.Step = 10; + sliderLowBatteryWarning.TabIndex = 50; + sliderLowBatteryWarning.TabStop = false; + sliderLowBatteryWarning.Text = "sliderBattery"; + sliderLowBatteryWarning.Value = 0; + // + // labelLowBatteryWarning + // + labelLowBatteryWarning.Location = new Point(7, 82); + labelLowBatteryWarning.Margin = new Padding(6, 0, 6, 0); + labelLowBatteryWarning.Name = "labelLowBatteryWarning"; + labelLowBatteryWarning.Size = new Size(316, 33); + labelLowBatteryWarning.TabIndex = 57; + labelLowBatteryWarning.Text = "Low Battery Warning"; + // + // labelAutoPowerOff + // + labelAutoPowerOff.Location = new Point(7, 43); + labelAutoPowerOff.Margin = new Padding(6, 0, 6, 0); + labelAutoPowerOff.Name = "labelAutoPowerOff"; + labelAutoPowerOff.Size = new Size(316, 33); + labelAutoPowerOff.TabIndex = 56; + labelAutoPowerOff.Text = "Auto Power Off"; + // + // panelEnergyHeader + // + panelEnergyHeader.BackColor = SystemColors.ControlLight; + panelEnergyHeader.Controls.Add(pictureBoxEnergy); + panelEnergyHeader.Controls.Add(labelEnergy); + panelEnergyHeader.Dock = DockStyle.Top; + panelEnergyHeader.Location = new Point(0, 0); + panelEnergyHeader.Name = "panelEnergyHeader"; + panelEnergyHeader.Size = new Size(654, 30); + panelEnergyHeader.TabIndex = 41; + // + // pictureBoxEnergy + // + pictureBoxEnergy.BackgroundImage = Properties.Resources.icons8_charging_battery_32; + pictureBoxEnergy.BackgroundImageLayout = ImageLayout.Zoom; + pictureBoxEnergy.Location = new Point(4, 0); + pictureBoxEnergy.Name = "pictureBoxEnergy"; + pictureBoxEnergy.Size = new Size(24, 24); + pictureBoxEnergy.TabIndex = 35; + pictureBoxEnergy.TabStop = false; + // + // labelEnergy + // + labelEnergy.AutoSize = true; + labelEnergy.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelEnergy.Location = new Point(33, 0); + labelEnergy.Margin = new Padding(6, 0, 6, 0); + labelEnergy.Name = "labelEnergy"; + labelEnergy.Size = new Size(71, 25); + labelEnergy.TabIndex = 34; + labelEnergy.Text = "Energy"; + // + // tableLayoutProfiles + // + tableLayoutProfiles.AutoSize = true; + tableLayoutProfiles.AutoSizeMode = AutoSizeMode.GrowAndShrink; + tableLayoutProfiles.ColumnCount = 2; + tableLayoutProfiles.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + tableLayoutProfiles.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + tableLayoutProfiles.Controls.Add(panelProfiles, 1, 0); + tableLayoutProfiles.Controls.Add(panelBatteryState, 0, 0); + tableLayoutProfiles.Dock = DockStyle.Top; + tableLayoutProfiles.Location = new Point(11, 11); + tableLayoutProfiles.Name = "tableLayoutProfiles"; + tableLayoutProfiles.RowCount = 1; + tableLayoutProfiles.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); + tableLayoutProfiles.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); + tableLayoutProfiles.Size = new Size(654, 57); + tableLayoutProfiles.TabIndex = 44; + // + // panelBatteryState + // + panelBatteryState.Controls.Add(labelChargingState); + panelBatteryState.Controls.Add(labelBatteryState); + panelBatteryState.Controls.Add(pictureBoxBatteryState); + panelBatteryState.Location = new Point(3, 3); + panelBatteryState.Name = "panelBatteryState"; + panelBatteryState.Size = new Size(300, 50); + panelBatteryState.TabIndex = 1; + // + // labelChargingState + // + labelChargingState.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; + labelChargingState.AutoSize = true; + labelChargingState.Font = new Font("Segoe UI", 10F, FontStyle.Bold, GraphicsUnit.Point); + labelChargingState.Location = new Point(116, 10); + labelChargingState.Name = "labelChargingState"; + labelChargingState.Size = new Size(97, 28); + labelChargingState.TabIndex = 38; + labelChargingState.Text = "Charging"; + labelChargingState.TextAlign = ContentAlignment.MiddleLeft; + // + // labelBatteryState + // + labelBatteryState.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + labelBatteryState.AutoSize = true; + labelBatteryState.Font = new Font("Segoe UI", 10F, FontStyle.Bold, GraphicsUnit.Point); + labelBatteryState.Location = new Point(45, 10); + labelBatteryState.Name = "labelBatteryState"; + labelBatteryState.Size = new Size(65, 28); + labelBatteryState.TabIndex = 37; + labelBatteryState.Text = "100%"; + labelBatteryState.TextAlign = ContentAlignment.MiddleRight; + // + // pictureBoxBatteryState + // + pictureBoxBatteryState.BackgroundImage = Properties.Resources.icons8_ladende_batterie_48; + pictureBoxBatteryState.BackgroundImageLayout = ImageLayout.Zoom; + pictureBoxBatteryState.Dock = DockStyle.Left; + pictureBoxBatteryState.Location = new Point(0, 0); + pictureBoxBatteryState.Name = "pictureBoxBatteryState"; + pictureBoxBatteryState.Size = new Size(39, 50); + pictureBoxBatteryState.TabIndex = 36; + pictureBoxBatteryState.TabStop = false; + // + // buttonSync + // + buttonSync.AccessibleName = "Keyboard Color"; + buttonSync.Activated = false; + buttonSync.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonSync.BackColor = SystemColors.ButtonHighlight; + buttonSync.BorderColor = Color.Transparent; + buttonSync.BorderRadius = 2; + buttonSync.FlatStyle = FlatStyle.Flat; + buttonSync.ForeColor = SystemColors.ControlText; + buttonSync.Location = new Point(358, 8); + buttonSync.Margin = new Padding(3, 6, 3, 6); + buttonSync.Name = "buttonSync"; + buttonSync.Secondary = false; + buttonSync.Size = new Size(292, 37); + buttonSync.TabIndex = 46; + buttonSync.Text = "Synchronize with Mouse"; + buttonSync.UseVisualStyleBackColor = false; + buttonSync.Click += ButtonSync_Click; + // + // panelBottomButtons + // + panelBottomButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelBottomButtons.Controls.Add(buttonSync); + panelBottomButtons.Dock = DockStyle.Top; + panelBottomButtons.Location = new Point(11, 883); + panelBottomButtons.Name = "panelBottomButtons"; + panelBottomButtons.Size = new Size(654, 67); + panelBottomButtons.TabIndex = 47; + // + // AsusMouseSettings + // + AutoScaleDimensions = new SizeF(144F, 144F); + AutoScaleMode = AutoScaleMode.Dpi; + AutoScroll = true; + AutoSize = true; + AutoSizeMode = AutoSizeMode.GrowAndShrink; + ClientSize = new Size(676, 1030); + Controls.Add(panelBottomButtons); + Controls.Add(panelEnergy); + Controls.Add(panelLighting); + Controls.Add(panelPerformance); + Controls.Add(tableLayoutProfiles); + MaximizeBox = false; + MdiChildrenMinimizedAnchorBottom = false; + MinimizeBox = false; + MinimumSize = new Size(690, 600); + Name = "AsusMouseSettings"; + Padding = new Padding(11); + ShowIcon = false; + ShowInTaskbar = false; + Text = "Mouse Settings"; + panelProfiles.ResumeLayout(false); + panelProfiles.PerformLayout(); + panelPerformance.ResumeLayout(false); + panelPerformance.PerformLayout(); + panelPerformanceOther.ResumeLayout(false); + panelDPISettings.ResumeLayout(false); + panelDPISettings.PerformLayout(); + tableLayoutPanel1.ResumeLayout(false); + panelDPITile.ResumeLayout(false); + panelDPITile.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureDPIColor).EndInit(); + tableDPI.ResumeLayout(false); + panelPerformanceHeader.ResumeLayout(false); + panelPerformanceHeader.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureKeyboard).EndInit(); + panelLighting.ResumeLayout(false); + panelLighting.PerformLayout(); + panelLightingContent.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)pictureBoxLightingColor).EndInit(); + panelLightingHeader.ResumeLayout(false); + panelLightingHeader.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxLighting).EndInit(); + panelEnergy.ResumeLayout(false); + panelEnergyHeader.ResumeLayout(false); + panelEnergyHeader.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxEnergy).EndInit(); + tableLayoutProfiles.ResumeLayout(false); + panelBatteryState.ResumeLayout(false); + panelBatteryState.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxBatteryState).EndInit(); + panelBottomButtons.ResumeLayout(false); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Panel panelProfiles; + private Label labelProfile; + private UI.RComboBox comboProfile; + private Panel panelPerformance; + private Panel panelPerformanceHeader; + private PictureBox pictureKeyboard; + private Label labelPerformance; + private Panel panelLighting; + private Panel panelLightingHeader; + private PictureBox pictureBoxLighting; + private Label labelLighting; + private Panel panelEnergy; + private Panel panelEnergyHeader; + private PictureBox pictureBoxEnergy; + private Label labelEnergy; + private TableLayoutPanel tableDPI; + private UI.RButton buttonDPI2; + private UI.RButton buttonDPI1; + private UI.RButton buttonDPI3; + private UI.RButton buttonDPI4; + private UI.Slider sliderDPI; + private Panel panelDPISettings; + private TableLayoutPanel tableLayoutPanel1; + private Label labelMinDPI; + private Label labelDPIValue; + private Label labelMaxDPI; + private Panel panelDPITile; + private Label labelDPI; + private TableLayoutPanel tableLayoutPollingRate; + private UI.RComboBox comboBoxPollingRate; + private UI.Slider sliderAngleAdjustment; + private CheckBox checkBoxAngleSnapping; + private Panel panelPerformanceOther; + private TableLayoutPanel tableLayoutProfiles; + private UI.RButton buttonDPIColor; + private PictureBox pictureDPIColor; + private UI.Slider sliderBrightness; + private Label labelPollingRate; + private Label labelAngleAdjustmentValue; + private Panel panelLightingContent; + private UI.RComboBox comboBoxLightingMode; + private Label labelLightingMode; + private PictureBox pictureBoxLightingColor; + private UI.RButton buttonLightingColor; + private CheckBox checkBoxRandomColor; + private UI.RComboBox comboBoxAnimationSpeed; + private Label labelAnimationSpeed; + private UI.RComboBox comboBoxAnimationDirection; + private Label labelAnimationDirection; + private UI.RComboBox comboBoxLiftOffDistance; + private Label labelLiftOffDistance; + private Label labelLowBatteryWarningValue; + private UI.RComboBox comboBoxAutoPowerOff; + private UI.Slider sliderLowBatteryWarning; + private Label labelLowBatteryWarning; + private Label labelAutoPowerOff; + private Panel panelBatteryState; + private Label labelChargingState; + private Label labelBatteryState; + private PictureBox pictureBoxBatteryState; + private UI.RButton buttonSync; + private Panel panelBottomButtons; + } +} \ No newline at end of file diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs new file mode 100644 index 00000000..7c5dfc72 --- /dev/null +++ b/app/AsusMouseSettings.cs @@ -0,0 +1,569 @@ +using GHelper.Peripherals.Mouse; +using GHelper.UI; +using System.Windows.Forms; + +namespace GHelper +{ + public partial class AsusMouseSettings : RForm + { + private static Dictionary lightingModeNames = new Dictionary() + { + { LightingMode.Static,Properties.Strings.AuraStatic}, + { LightingMode.Breathing, Properties.Strings.AuraBreathe}, + { LightingMode.ColorCycle, Properties.Strings.AuraColorCycle}, + { LightingMode.Rainbow, Properties.Strings.AuraRainbow}, + { LightingMode.React, Properties.Strings.AuraReact}, + { LightingMode.Comet, Properties.Strings.AuraComet}, + { LightingMode.BatteryState, Properties.Strings.AuraBatteryState}, + }; + private List supportedLightingModes = new List(); + + private readonly AsusMouse mouse; + private readonly RButton[] dpiButtons; + + public AsusMouseSettings(AsusMouse mouse) + { + this.mouse = mouse; + InitializeComponent(); + + dpiButtons = new RButton[] { buttonDPI1, buttonDPI2, buttonDPI3, buttonDPI4 }; + + + labelPollingRate.Text = Properties.Strings.PollingRate; + labelLighting.Text = Properties.Strings.Lighting; + labelEnergy.Text = Properties.Strings.EnergySettings; + labelPerformance.Text = Properties.Strings.MousePerformance; + checkBoxRandomColor.Text = Properties.Strings.AuraRandomColor; + labelLowBatteryWarning.Text = Properties.Strings.MouseLowBatteryWarning; + labelAutoPowerOff.Text = Properties.Strings.MouseAutoPowerOff; + buttonSync.Text = Properties.Strings.MouseSynchronize; + checkBoxAngleSnapping.Text = Properties.Strings.MouseAngleSnapping; + labelLiftOffDistance.Text = Properties.Strings.MouseLiftOffDistance; + labelChargingState.Text = Properties.Strings.Charging; + labelProfile.Text = Properties.Strings.Profile; + + InitTheme(); + + this.Text = mouse.GetDisplayName(); + + Shown += AsusMouseSettings_Shown; + + mouse.Disconnect += Mouse_Disconnect; + mouse.BatteryUpdated += Mouse_BatteryUpdated; + comboProfile.DropDownClosed += ComboProfile_DropDownClosed; + + sliderDPI.ValueChanged += SliderDPI_ValueChanged; + sliderDPI.MouseUp += SliderDPI_MouseUp; + buttonDPIColor.Click += ButtonDPIColor_Click; + buttonDPI1.Click += ButtonDPI_Click; + buttonDPI2.Click += ButtonDPI_Click; + buttonDPI3.Click += ButtonDPI_Click; + buttonDPI4.Click += ButtonDPI_Click; + + comboBoxPollingRate.DropDownClosed += ComboBoxPollingRate_DropDownClosed; + checkBoxAngleSnapping.CheckedChanged += CheckAngleSnapping_CheckedChanged; + sliderAngleAdjustment.ValueChanged += SliderAngleAdjustment_ValueChanged; + sliderAngleAdjustment.MouseUp += SliderAngleAdjustment_MouseUp; + comboBoxLiftOffDistance.DropDownClosed += ComboBoxLiftOffDistance_DropDownClosed; + + buttonLightingColor.Click += ButtonLightingColor_Click; + comboBoxLightingMode.DropDownClosed += ComboBoxLightingMode_DropDownClosed; + sliderBrightness.MouseUp += SliderBrightness_MouseUp; + comboBoxAnimationSpeed.DropDownClosed += ComboBoxAnimationSpeed_DropDownClosed; + comboBoxAnimationDirection.DropDownClosed += ComboBoxAnimationDirection_DropDownClosed; + checkBoxRandomColor.CheckedChanged += CheckBoxRandomColor_CheckedChanged; + + sliderLowBatteryWarning.ValueChanged += SliderLowBatteryWarning_ValueChanged; + sliderLowBatteryWarning.MouseUp += SliderLowBatteryWarning_MouseUp; + comboBoxAutoPowerOff.DropDownClosed += ComboBoxAutoPowerOff_DropDownClosed; + + InitMouseCapabilities(); + RefreshMouseData(); + } + + private void Mouse_BatteryUpdated(object? sender, EventArgs e) + { + this.Invoke(delegate + { + VisualizeBatteryState(); + }); + + } + + private void ComboProfile_DropDownClosed(object? sender, EventArgs e) + { + mouse.SetProfile(comboProfile.SelectedIndex); + RefreshMouseData(); + } + + private void ComboBoxPollingRate_DropDownClosed(object? sender, EventArgs e) + { + mouse.SetPollingRate(comboBoxPollingRate.SelectedIndex + 1); + } + + private void ButtonDPIColor_Click(object? sender, EventArgs e) + { + ColorDialog colorDlg = new ColorDialog + { + AllowFullOpen = true, + Color = pictureDPIColor.BackColor + }; + + if (colorDlg.ShowDialog() == DialogResult.OK) + { + AsusMouseDPI dpi = mouse.DpiSettings[mouse.DpiProfile - 1]; + dpi.Color = colorDlg.Color; + + mouse.SetDPIForProfile(dpi, mouse.DpiProfile); + + VisualizeDPIButtons(); + VisualizeCurrentDPIProfile(); + } + } + + private void ButtonDPI_Click(object? sender, EventArgs e) + { + int index = -1; + + for (int i = 0; i < dpiButtons.Length; ++i) + { + if (sender == dpiButtons[i]) + { + index = i; + break; + } + } + + if (index == -1) + { + //huh? + return; + } + + mouse.SetDPIProfile(index + 1); + VisualizeDPIButtons(); + VisualizeCurrentDPIProfile(); + } + + + private void CheckBoxRandomColor_CheckedChanged(object? sender, EventArgs e) + { + LightingSetting? ls = mouse.LightingSetting; + ls.RandomColor = checkBoxRandomColor.Checked; + + mouse.SetLightingSetting(ls); + VisusalizeLightingSettings(); + } + + private void ComboBoxAnimationDirection_DropDownClosed(object? sender, EventArgs e) + { + LightingSetting? ls = mouse.LightingSetting; + ls.AnimationDirection = (AnimationDirection)comboBoxAnimationDirection.SelectedIndex; + + mouse.SetLightingSetting(ls); + VisusalizeLightingSettings(); + } + + private void ComboBoxAnimationSpeed_DropDownClosed(object? sender, EventArgs e) + { + LightingSetting? ls = mouse.LightingSetting; + ls.AnimationSpeed = (AnimationSpeed)comboBoxAnimationSpeed.SelectedIndex; + + mouse.SetLightingSetting(ls); + VisusalizeLightingSettings(); + } + + private void SliderBrightness_MouseUp(object? sender, MouseEventArgs e) + { + LightingSetting? ls = mouse.LightingSetting; + ls.Brightness = sliderBrightness.Value; + + mouse.SetLightingSetting(ls); + } + + private void ComboBoxLightingMode_DropDownClosed(object? sender, EventArgs e) + { + LightingMode lm = supportedLightingModes[comboBoxLightingMode.SelectedIndex]; + + LightingSetting? ls = mouse.LightingSetting; + ls.LightingMode = lm; + + mouse.SetLightingSetting(ls); + VisusalizeLightingSettings(); + } + + private void ButtonLightingColor_Click(object? sender, EventArgs e) + { + ColorDialog colorDlg = new ColorDialog + { + AllowFullOpen = true, + Color = pictureBoxLightingColor.BackColor + }; + + if (colorDlg.ShowDialog() == DialogResult.OK) + { + LightingSetting? ls = mouse.LightingSetting; + ls.RGBColor = colorDlg.Color; + + mouse.SetLightingSetting(ls); + VisusalizeLightingSettings(); + } + } + + private void SliderLowBatteryWarning_ValueChanged(object? sender, EventArgs e) + { + labelLowBatteryWarningValue.Text = sliderLowBatteryWarning.Value.ToString() + "%"; + } + + private void SliderLowBatteryWarning_MouseUp(object? sender, MouseEventArgs e) + { + mouse.SetEnergySettings(sliderLowBatteryWarning.Value, mouse.PowerOffSetting); + } + + + private void ComboBoxAutoPowerOff_DropDownClosed(object? sender, EventArgs e) + { + object? obj = Enum.GetValues(typeof(PowerOffSetting)).GetValue(comboBoxAutoPowerOff.SelectedIndex); + if (obj is null) + { + return; + } + PowerOffSetting pos = (PowerOffSetting)obj; + + + mouse.SetEnergySettings(mouse.LowBatteryWarning, pos); + } + + private void SliderAngleAdjustment_ValueChanged(object? sender, EventArgs e) + { + labelAngleAdjustmentValue.Text = sliderAngleAdjustment.Value.ToString() + "°"; + } + + private void SliderAngleAdjustment_MouseUp(object? sender, MouseEventArgs e) + { + mouse.SetAngleAdjustment((short)sliderAngleAdjustment.Value); + } + + private void ComboBoxLiftOffDistance_DropDownClosed(object? sender, EventArgs e) + { + mouse.SetLiftOffDistance((LiftOffDistance)comboBoxLiftOffDistance.SelectedIndex); + } + + private void CheckAngleSnapping_CheckedChanged(object? sender, EventArgs e) + { + mouse.SetAngleSnapping(checkBoxAngleSnapping.Checked); + mouse.SetAngleAdjustment((short)sliderAngleAdjustment.Value); + } + + private void SliderDPI_ValueChanged(object? sender, EventArgs e) + { + labelDPIValue.Text = sliderDPI.Value.ToString(); + } + + private void SliderDPI_MouseUp(object? sender, MouseEventArgs e) + { + AsusMouseDPI dpi = mouse.DpiSettings[mouse.DpiProfile - 1]; + dpi.DPI = (uint)sliderDPI.Value; + + mouse.SetDPIForProfile(dpi, mouse.DpiProfile); + + VisualizeDPIButtons(); + VisualizeCurrentDPIProfile(); + } + + private void Mouse_Disconnect(object? sender, EventArgs e) + { + //Mouse disconnected. Bye bye. + this.Invoke(delegate + { + this.Close(); + }); + + } + + private void RefreshMouseData() + { + mouse.SynchronizeDevice(); + if (!mouse.IsDeviceReady) + { + this.Invoke(delegate + { + this.Close(); + }); + return; + } + + + VisualizeMouseSettings(); + VisualizeBatteryState(); + } + + private void InitMouseCapabilities() + { + for (int i = 0; i < mouse.ProfileCount(); ++i) + { + String prf = Properties.Strings.Profile + " " + (i + 1); + comboProfile.Items.Add(prf); + } + + labelMinDPI.Text = mouse.MinDPI().ToString(); + labelMaxDPI.Text = mouse.MaxDPI().ToString(); + + sliderDPI.Max = mouse.MaxDPI(); + sliderDPI.Min = mouse.MinDPI(); + + + if (!mouse.HasDPIColors()) + { + buttonDPIColor.Visible = false; + pictureDPIColor.Visible = false; + buttonDPI1.Image = ControlHelper.TintImage(Properties.Resources.lighting_dot_24, Color.Red); + buttonDPI2.Image = ControlHelper.TintImage(Properties.Resources.lighting_dot_24, Color.Purple); + buttonDPI3.Image = ControlHelper.TintImage(Properties.Resources.lighting_dot_24, Color.Blue); + buttonDPI4.Image = ControlHelper.TintImage(Properties.Resources.lighting_dot_24, Color.Green); + + buttonDPI1.BorderColor = Color.Red; + buttonDPI1.BorderColor = Color.Purple; + buttonDPI1.BorderColor = Color.Blue; + buttonDPI1.BorderColor = Color.Green; + } + + if (mouse.CanSetPollingRate()) + { + comboBoxPollingRate.Items.AddRange(mouse.PollingRateDisplayStrings()); + } + else + { + comboBoxPollingRate.Visible = false; + labelPollingRate.Visible = false; + } + + if (!mouse.HasAngleSnapping()) + { + checkBoxAngleSnapping.Visible = false; + labelAngleAdjustmentValue.Visible = false; + sliderAngleAdjustment.Visible = false; + } + + if (mouse.HasLiftOffSetting()) + { + comboBoxLiftOffDistance.Items.AddRange(new string[] { + Properties.Strings.Low, + Properties.Strings.High, + }); + } + else + { + comboBoxLiftOffDistance.Visible = false; + labelLiftOffDistance.Visible = false; + } + + if (mouse.DPIProfileCount() < 4) + { + for (int i = 3; i > mouse.DPIProfileCount() - 1; --i) + { + dpiButtons[i].Visible = false; + } + } + + if (!mouse.HasBattery()) + { + panelBatteryState.Visible = false; + } + + if (mouse.HasEnergySettings()) + { + comboBoxAutoPowerOff.Items.AddRange(new string[]{ + " 1 "+ Properties.Strings.Minute, + " 2 "+ Properties.Strings.Minutes, + " 3 "+ Properties.Strings.Minutes, + " 5 "+ Properties.Strings.Minutes, + "10 "+ Properties.Strings.Minutes, + Properties.Strings.Never, + }); + } + else + { + panelEnergy.Visible = false; + } + + if (mouse.HasRGB()) + { + foreach (LightingMode lm in Enum.GetValues(typeof(LightingMode))) + { + if (mouse.IsLightingModeSupported(lm)) + { + comboBoxLightingMode.Items.Add(lightingModeNames.GetValueOrDefault(lm)); + supportedLightingModes.Add(lm); + } + } + + comboBoxAnimationDirection.Items.AddRange(new string[] { + Properties.Strings.AuraClockwise, + Properties.Strings.AuraCounterClockwise, + }); + + comboBoxAnimationSpeed.Items.AddRange(new string[] { + Properties.Strings.AuraSlow, + Properties.Strings.AuraNormal, + Properties.Strings.AuraFast + }); + } + else + { + panelLighting.Visible = false; + } + } + + + private void VisualizeMouseSettings() + { + comboProfile.SelectedIndex = mouse.Profile; + + VisualizeDPIButtons(); + VisualizeCurrentDPIProfile(); + VisusalizeLightingSettings(); + + if (mouse.CanSetPollingRate()) + { + comboBoxPollingRate.SelectedIndex = mouse.PollingRate - 1; + } + + if (mouse.HasAngleSnapping()) + { + checkBoxAngleSnapping.Checked = mouse.AngleSnapping; + sliderAngleAdjustment.Value = mouse.AngleAdjustmentDegrees; + } + + if (mouse.HasEnergySettings()) + { + if (mouse.PowerOffSetting == PowerOffSetting.Never) + { + comboBoxAutoPowerOff.SelectedIndex = comboBoxAutoPowerOff.Items.Count - 1; + } + else + { + comboBoxAutoPowerOff.SelectedIndex = (int)mouse.PowerOffSetting; + } + + sliderLowBatteryWarning.Value = mouse.LowBatteryWarning; + + } + + if (mouse.HasLiftOffSetting()) + { + comboBoxLiftOffDistance.SelectedIndex = (int)mouse.LiftOffDistance; + } + } + + private void VisualizeBatteryState() + { + if (!mouse.HasBattery()) + { + return; + } + + labelBatteryState.Text = mouse.Battery + "%"; + labelChargingState.Visible = mouse.Charging; + + if (mouse.Charging) + { + pictureBoxBatteryState.BackgroundImage = ControlHelper.TintImage(Properties.Resources.icons8_ladende_batterie_48, foreMain); + } + else + { + pictureBoxBatteryState.BackgroundImage = ControlHelper.TintImage(Properties.Resources.icons8_batterie_voll_geladen_48, foreMain); + } + } + + private void VisusalizeLightingSettings() + { + if (!mouse.HasRGB()) + { + return; + } + + LightingSetting? ls = mouse.LightingSetting; + + if (ls is null) + { + //Lighting settings not loaded? + return; + } + + sliderBrightness.Value = ls.Brightness; + + checkBoxRandomColor.Visible = mouse.SupportsRandomColor(ls.LightingMode); + + pictureBoxLightingColor.Visible = mouse.SupportsColorSetting(ls.LightingMode); + pictureBoxLightingColor.Visible = mouse.SupportsColorSetting(ls.LightingMode); + + comboBoxAnimationSpeed.Visible = mouse.SupportsAnimationSpeed(ls.LightingMode); + labelAnimationSpeed.Visible = mouse.SupportsAnimationSpeed(ls.LightingMode); + comboBoxAnimationDirection.Visible = mouse.SupportsAnimationDirection(ls.LightingMode); + labelAnimationDirection.Visible = mouse.SupportsAnimationDirection(ls.LightingMode); + + comboBoxLightingMode.SelectedIndex = supportedLightingModes.IndexOf(ls.LightingMode); + + if (mouse.SupportsRandomColor(ls.LightingMode)) + { + checkBoxRandomColor.Checked = ls.RandomColor; + buttonLightingColor.Visible = !ls.RandomColor; + + } + + if (ls.RandomColor && mouse.SupportsRandomColor(ls.LightingMode)) + pictureBoxLightingColor.BackColor = Color.Transparent; + else + pictureBoxLightingColor.BackColor = ls.RGBColor; + + + comboBoxAnimationSpeed.SelectedIndex = (((int)ls.AnimationSpeed) - 5) / 2; + comboBoxAnimationDirection.SelectedIndex = (int)ls.AnimationDirection; + } + + + private void VisualizeDPIButtons() + { + if (mouse.HasDPIColors()) + { + for (int i = 0; i < mouse.DPIProfileCount() && i < 4; ++i) + { + AsusMouseDPI dpi = mouse.DpiSettings[i]; + dpiButtons[i].Image = ControlHelper.TintImage(Properties.Resources.lighting_dot_24, dpi.Color); + dpiButtons[i].Activated = (mouse.DpiProfile - 1) == i; + dpiButtons[i].BorderColor = dpi.Color; + dpiButtons[i].Text = "DPI " + (i + 1) + "\n" + dpi.DPI; + } + } + + } + + private void VisualizeCurrentDPIProfile() + { + AsusMouseDPI dpi = mouse.DpiSettings[mouse.DpiProfile - 1]; + sliderDPI.Value = (int)dpi.DPI; + pictureDPIColor.BackColor = dpi.Color; + } + + private void AsusMouseSettings_Shown(object? sender, EventArgs e) + { + + if (Height > Program.settingsForm.Height) + { + Top = Program.settingsForm.Top + Program.settingsForm.Height - Height; + } + else + { + Top = Program.settingsForm.Top; + } + + Left = Program.settingsForm.Left - Width - 5; + } + + private void ButtonSync_Click(object sender, EventArgs e) + { + RefreshMouseData(); + } + } +} diff --git a/app/AsusMouseSettings.resx b/app/AsusMouseSettings.resx new file mode 100644 index 00000000..a395bffc --- /dev/null +++ b/app/AsusMouseSettings.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 387961ba..48a7f8ec 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -140,6 +140,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_batterie_voll_geladen_48 { + get { + object obj = ResourceManager.GetObject("icons8_batterie_voll_geladen_48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -280,6 +290,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_ladende_batterie_48 { + get { + object obj = ResourceManager.GetObject("icons8_ladende_batterie_48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -339,7 +359,17 @@ namespace GHelper.Properties { return ((System.Drawing.Bitmap)(obj)); } } - + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_mauszeiger_50 { + get { + object obj = ResourceManager.GetObject("icons8_mauszeiger_50", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -521,7 +551,37 @@ namespace GHelper.Properties { } /// - /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap lighting_dot_24 { + get { + object obj = ResourceManager.GetObject("lighting_dot_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap lighting_dot_32 { + get { + object obj = ResourceManager.GetObject("lighting_dot_32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap lighting_dot_48 { + get { + object obj = ResourceManager.GetObject("lighting_dot_48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon ähnlich wie (Symbol). /// internal static System.Drawing.Icon standard { get { diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index f36d49f1..c9595ed8 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -262,4 +262,22 @@ ..\Resources\icons8-maus-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-mauszeiger-50.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-batterie-voll-geladen-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-ladende-batterie-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\lighting_dot_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\lighting_dot_48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\lighting_dot_24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/app/Properties/Strings.Designer.cs b/app/Properties/Strings.Designer.cs index a5c19305..77290fe0 100644 --- a/app/Properties/Strings.Designer.cs +++ b/app/Properties/Strings.Designer.cs @@ -195,6 +195,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Battery State. + /// + internal static string AuraBatteryState { + get { + return ResourceManager.GetString("AuraBatteryState", resourceCulture); + } + } + /// /// Looks up a localized string similar to Breathe. /// @@ -204,6 +213,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Clockwise. + /// + internal static string AuraClockwise { + get { + return ResourceManager.GetString("AuraClockwise", resourceCulture); + } + } + /// /// Looks up a localized string similar to Color Cycle. /// @@ -213,6 +231,24 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Comet. + /// + internal static string AuraComet { + get { + return ResourceManager.GetString("AuraComet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Counterclockwise. + /// + internal static string AuraCounterClockwise { + get { + return ResourceManager.GetString("AuraCounterClockwise", resourceCulture); + } + } + /// /// Looks up a localized string similar to Fast. /// @@ -240,6 +276,24 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Random. + /// + internal static string AuraRandomColor { + get { + return ResourceManager.GetString("AuraRandomColor", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to React. + /// + internal static string AuraReact { + get { + return ResourceManager.GetString("AuraReact", resourceCulture); + } + } + /// /// Looks up a localized string similar to Slow. /// @@ -503,6 +557,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Energy Settings. + /// + internal static string EnergySettings { + get { + return ResourceManager.GetString("EnergySettings", resourceCulture); + } + } + /// /// Looks up a localized string similar to Extra. /// @@ -701,6 +764,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to High. + /// + internal static string High { + get { + return ResourceManager.GetString("High", resourceCulture); + } + } + /// /// Looks up a localized string similar to Key Bindings. /// @@ -773,6 +845,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Lighting. + /// + internal static string Lighting { + get { + return ResourceManager.GetString("Lighting", resourceCulture); + } + } + /// /// Looks up a localized string similar to Logo. /// @@ -782,6 +863,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Low. + /// + internal static string Low { + get { + return ResourceManager.GetString("Low", resourceCulture); + } + } + /// /// Looks up a localized string similar to Audio Visualizer. /// @@ -881,6 +971,78 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Minute. + /// + internal static string Minute { + get { + return ResourceManager.GetString("Minute", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Minutes. + /// + internal static string Minutes { + get { + return ResourceManager.GetString("Minutes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Angle Snapping. + /// + internal static string MouseAngleSnapping { + get { + return ResourceManager.GetString("MouseAngleSnapping", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auto Power Off After. + /// + internal static string MouseAutoPowerOff { + get { + return ResourceManager.GetString("MouseAutoPowerOff", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lift Off Distance. + /// + internal static string MouseLiftOffDistance { + get { + return ResourceManager.GetString("MouseLiftOffDistance", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Low Battery Warning at. + /// + internal static string MouseLowBatteryWarning { + get { + return ResourceManager.GetString("MouseLowBatteryWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Performance. + /// + internal static string MousePerformance { + get { + return ResourceManager.GetString("MousePerformance", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Synchronize with mouse. + /// + internal static string MouseSynchronize { + get { + return ResourceManager.GetString("MouseSynchronize", resourceCulture); + } + } + /// /// Looks up a localized string similar to Multizone. /// @@ -899,6 +1061,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Never. + /// + internal static string Never { + get { + return ResourceManager.GetString("Never", resourceCulture); + } + } + /// /// Looks up a localized string similar to New updates. /// @@ -918,7 +1089,7 @@ namespace GHelper.Properties { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Not Connected ähnelt. + /// Looks up a localized string similar to Not Connected. /// internal static string NotConnected { get { @@ -990,7 +1161,7 @@ namespace GHelper.Properties { } /// - /// Sucht eine lokalisierte Zeichenfolge, die Peripherals ähnelt. + /// Looks up a localized string similar to Peripherals. /// internal static string Peripherals { get { @@ -1016,6 +1187,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Polling Rate. + /// + internal static string PollingRate { + get { + return ResourceManager.GetString("PollingRate", resourceCulture); + } + } + /// /// Looks up a localized string similar to Power Limits. /// @@ -1043,6 +1223,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Profile. + /// + internal static string Profile { + get { + return ResourceManager.GetString("Profile", resourceCulture); + } + } + /// /// Looks up a localized string similar to Quit. /// diff --git a/app/Properties/Strings.resx b/app/Properties/Strings.resx index aa381582..52715934 100644 --- a/app/Properties/Strings.resx +++ b/app/Properties/Strings.resx @@ -162,12 +162,24 @@ Asus Services Running + + Battery State + Breathe + + Clockwise + Color Cycle + + Comet + + + Counterclockwise + Fast @@ -177,6 +189,12 @@ Rainbow + + Random + + + React + Slow @@ -266,6 +284,9 @@ Do you still want to continue? NVIDIA Display Mode is not set to Optimus + + Energy Settings + Extra @@ -332,6 +353,9 @@ Do you still want to continue? Temperature Target + + High + Key Bindings @@ -356,9 +380,15 @@ Do you still want to continue? Lightbar + + Lighting + Logo + + Low + Audio Visualizer @@ -392,12 +422,39 @@ Do you still want to continue? 60Hz refresh rate to save battery + + Minute + + + Minutes + + + Angle Snapping + + + Auto Power Off After + + + Lift Off Distance + + + Low Battery Warning at + + + Performance + + + Synchronize with mouse + Multizone Mute Mic + + Never + New updates @@ -437,6 +494,9 @@ Do you still want to continue? Play / Pause + + Polling Rate + Power Limits @@ -446,6 +506,9 @@ Do you still want to continue? PrintScreen + + Profile + Quit diff --git a/app/Resources/icons8-batterie-voll-geladen-48.png b/app/Resources/icons8-batterie-voll-geladen-48.png new file mode 100644 index 0000000000000000000000000000000000000000..96477f33bbcc099bb357e225dbd8cebf9758f418 GIT binary patch literal 262 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC&H|6fVg?3oVGw3ym^DWND7eGZ z#WAE}&fA%eT+IdouJ>)j1;pAdFE2W}s2uA1%nOjZx3Mb_+p*k=FseWRMP!|uR|`R8nmn0!Q;c_bOX$sL;6)S9$HKug5AHDIBHRtwkB0L2iEHm-$Eh9MozqEgyr zi6=NNgz{WSW7)xcp6lrM15;IIJvC0^pL^`-v&&uLKh@LxkLfMG=xDP7=m!Q*S3j3^ HP6_< literal 0 HcmV?d00001 diff --git a/app/Resources/icons8-ladende-batterie-48.png b/app/Resources/icons8-ladende-batterie-48.png new file mode 100644 index 0000000000000000000000000000000000000000..a1be3718a5009c54683836d5c722eb7e640a484f GIT binary patch literal 410 zcmV;L0cHM)P)2)qN=1M;E^JPpi?DzH_^ zizd)so1uBp1XfCUQ3SfyW@ug%frVn88q$G%Ycn)Y4e7vV_7YcugZ>N?IwLc{vOaK4?07*qoM6N<$ Ef}?k_!2kdN literal 0 HcmV?d00001 diff --git a/app/Resources/icons8-mauszeiger-50.png b/app/Resources/icons8-mauszeiger-50.png new file mode 100644 index 0000000000000000000000000000000000000000..90cbdaa32d4ced5dfe568b8153369fdb8c08a137 GIT binary patch literal 498 zcmV`~fV; zN>=QZg@ux(mFy(V!ot{D$WD}|#*YnQYRp$p-NiJ`Jr9}Zx#yhjyFRP?UEKGr)Aw__ z^z`)f4B;7GVVA;*ChxFU1tNht98`fw;46-+KqT-TCsiO4Sim_Ihy)gKQ3WD_C0tQ~ zNHn>n5|O|itXF|Z;2}1sKqT-OQz{S%JjWIlh(uF1x2ZrR@CLh8AQHJW=UAf*n)9I= zM562F9BZ7;nsbaG3tcql7*Q6--JD~DSsG_^jxpqVEh3*v68VAmc!?*tkK4G6!#Rr# z4)ba3!Dbl{|B^sCL`#0*Y%_B{G50o?dwi^tZ#c1R zX0mCwZ8B$MK&;3Y99?DZMnYsp2E?)qzWRZdx$XFwkU6Gf;va5#4-z7eWbnso7CZl9 z_Q;S0xlcj7NXXn(5Yq{f!5P}25GL>;A#+nfTuX?2ZuU+QY;9_L+oqpX5cgIHyv8ML oQW*O&kEb|=bzQ$uPmgx~0K(@RWS#^blmGw#07*qoM6N<$f?68Wn*aa+ literal 0 HcmV?d00001 diff --git a/app/Resources/lighting_dot_24.png b/app/Resources/lighting_dot_24.png new file mode 100644 index 0000000000000000000000000000000000000000..249426164ddeaab00587cc40ab340259a599efb1 GIT binary patch literal 2408 zcmb7GYg7|w8lK=nH9Z2y%L2-QY&cXw$xH$XGEImf2_y}n5ds9YNG_8wLNak?LIP5; zpjKAcmbKQlT2xS5K~Z#}9`6FJ)hdWpyVhL=TE*6C5ZYZ_+hu1G3Q}x)_Q%ZR`<~~$ zJ>NU;q*9ZXGMzbx2>`%!r9zfYJ%j0MsvmXlaf*fkz&8=q>PVeB6*gj4j^2bB5RS`g zr*Hreid}ZSu>c`i2E>BeL~Qr*(`*)M60x)SYDjIDBKfGI1V=JT(zM2s0%L-SEly+# zT`=XqijaDi%UWn7V3&yP@e5PG>1~kB@=(YE5nHF$u%sA{u=pH42Vy5OSwh@ohSO!q zqsG)q#Lg#4I}CzOr<3E1)U(L0w3pPKH_$8$pRKV)NpD0p?5w$3*jbRbwW~X{^U? z98yZ98XPmDg%n1lrzEkIa;bouAP~gxINk(k9bu(aZ$VNKn}y6D3qB5Hqo!Z((*+hf z=nl!Wp_C*%Ph5|QZXBcXfgtdyI62S8sAGfGRDYZFq+X^csa$ywFE$2>kKx5?x$$sZ z0?bWV0P$c5^2G7*F%xPo{yjF`(<~vySF2$KN{|>{?Ah`*dIqw}yYemzQBQ}{Jx=rW zM!G%`+m2%M(LVMl-8YM6@>D1$h#6lghh%GUjQA&womWFP17MH_?ID&~5&U}PE z+NUaugSoMAEHqjf_{>~9J@>1*c+vkS7q7+STqdeKnu`#m-~XRw5`vS2^b(#L7*q}3 zJ!%k96Ac_2Y1CqDC?Ym$65`azlb6WD0f14CQf)e^Jpo{TjictYDrw2Ab7EAl(`z)+ zigkSC`zgEM_N!m`p0ubBwzMB`i zgG99E@Z1gew$A1cKKJLxgefw+CZ~RFXY{ncetmByAH0@XxvD!eB#N0eGV-r$8v_Ei zG{isI)q5lE_Ubdu)5Xj7K6aSi6Q9c~EB`DtQoMRS;?PF{C-GY?gU_$dwYV3TPZLrf zuW5Eg4gmn12>N2U_K1rBz$Zy5lV}x{Tdv=HdFGNpzk%DfO|3rV{M_&}Dn)6Z#L%~G z2BNMCPwtu=9bPSMT6*V1rYaNKft+vCpV0z!1&kcrH?|I){eRf5Y^ zCl`s^0{eqIh?u{}trb?aUT)fNE)C!LMp)WFfW@(RGqC<#{GoNnU2C7{{Ld_`8aW$Q zG%)v{0DQ1Ku38l#e30i`(3~}8|0|3|9fDJN&)@bLILb`-{j`0^zt%VfeB=|r4evh! z*=P9e=nJ!b^3nT1h?a5KmCNjkAMm>`>8hRs2bH&`eOC=URQ_tgy%p&f8^{>qNCFW9~c$?fIWuItZMhIQT<-n4>orJa?1<#T^HE3)&T@x+^E z*_1W@`5Aw z!qnsogKkv_)R_8h0QbU{>c;sa(tR7vTTWf&9NSfvC4-n9wc2-YHt)D}@255Q9yaW& z@Yx@QXlm5f$m-8c!MSA}FP6Ufr97Y_xjKo1oK0FgTON05sOjo};8EC$$oF2J7xAHg zO~xJ8`RaM?nmTu|xP3@{;^TRhb(GY2AW{iuSwB+W*SeXEBN%N&8C0RY98{wDs&ZUASRa9or;F)~9z?)bDKg;NplX z#hi)n`*E)RXo#D4N3?yxb7c=!e3BXSr)`Jdh<>u?G-re{QqX8bw!3=iKS)Y>nye`) Gul#=o5PAmy literal 0 HcmV?d00001 diff --git a/app/Resources/lighting_dot_32.png b/app/Resources/lighting_dot_32.png new file mode 100644 index 0000000000000000000000000000000000000000..382ed5f5081df4fbc161ab596f8c554cfd868acd GIT binary patch literal 2521 zcmai0dt4J&79J#Z36Mnu(dvprkjE19E(ilL0znf>A_m07MQw&Nqh66wd z+n|<6lVBaV29_f#7V*jHMk0vFSj6T2d>UUJ4l59@Ndw221hG<6k~Bz0WG}D}F+iAr z64psTgECpAg$yjBRTsj3Tehi0&`QxIv4|pmG#HL*V9=l9PoWVP*n=S&St2ClEE+e) zRxF}Ir&B{zYHDgKC6!4*HF7FFC@6?ZV^A3kGR7cljVhhQKvrozEfQlI99S#WAZi_g zsz8gTWDTm1M)^)r5!&$mI$f^q0%Wd>f3Z3lK2t21$mFIR-igmt3cHg z2YAQD1pJ;Mmc9?07$oWsk@@`pO;;-4Ifhmjk%A>+JgM)*^t%IXtWgb9g|HUYYou^Q z3arw3S~FqE3lxnQ;A9a8QNk)MmR%N+$@l{({sTRoTkMZi7ssll(uvrKiCV%!1E{xQJGVYK+#cu||)9*Nv^lmdS{< z!$HtmXGkKoq=`jTYfzb93d^j{F}X2Rizez)B^o$Xj+K~23{6Z#u!I`HXiM*cbPAnD z33%5cRRLpaA3qy)JTj`~&ix)*2=%?-L#%|iE-7X=wufDQY>H4P#t62U7(}oNn?4$B z%p5Q3gaE+Cj9_JXuN(m2o2$=lBXO3xHnW+ECR)}S2^|p;MwYtF$}XN^pIy9k@~&d} z#zP|mCe)i>dogb5nx1PJjp^T3$7OL_3;mCUwi%f*%+{`(tX^&7^OBA;y&3-b!gkXr zcz_v1?tTtUKc6kQ=@0-N%T{jpJq67waa^ihe_Ki)RW^z%Q@R@W8@sG@ zh*!w*!WjN-=f}}`xzp}4CEs~ZcWqz}Dz?V+1^L4_Wn|ZW^9la-;zK_vrjdAL@;qvD zf#80@(+!u4u1kwY_71y?Z~ctx@43+WnaglLt?BO~r%^{H7`*nLliRPoEs<5kxP$3G z_~G;Jsk3($J){q;`%%h>alQQN^`lDnIiFINeV6vl-5a#qY3FJQ?3I}Vdf5zibM$ju zQE}wPp(%^loI4eYDqD5(*^y-t*^kd(@Yb;^oXNuchca=`Iz#ZLLR!t8g&o3j`F*Xx z9ju|m>j`NuulNk)+>iJ0lK)Uxe#D5qFYs!vSPK9YPs?LtILJ-`0NaH;PH3!X)3-%Q zF&)uUGWV1rO>tHBf%ZLc$vG$J)oV6!TTV`n-CF0BzWME$!*}aH51^CJ7!p(R%6win zoR*{I^g9*Xjisa1h@PRV>0IH)`CoUPd>M@Aho1%d7Opz=;(1IfH!o|O^UmUQ@hn@s z+DW8opMu9Ra8>37G@$C)&6ZfxTz6ZQ+x&Fzen6zJcI--h@{dXNz`xRS4*Y3V))j7= z!`uoxL*>e|laJy<3X^S;UL5gQvR!7JuCQgBrQOrj_9fZfN2B&d?e)IoB7R|a-KNx* zn!Y+=C2r?5_dpkOcz5=_U3Pk0$W9KJw~TCN+kRo2c9zt=_3S@KbB`-H>cJS}Lyx;Z z&+L@i+-Sb=rB6Z?I<>38vp@CJV}K+S6=V{^)U`EjKOLYr5xhJXdy`zaO{TBAhgfE| z=U;e1gTGZnxr#lx_1-x7l51wq{Qum#2ej!cdxLEnTpoNG<9swTe`IRkW&tTO&LtVQD}YR>C#;_|WZuE3*#ElSZ&E3D z_xeDd@6}A6)aXYd{Kir*oFVA^n`fO{>qYOL#Sdqt4swoXZ72+#opGA5e$Mb=`RYe? z{DF12!|sl)K3$|+PLXXCymH9NBc)-|9Nc=a-}5O@5|}5Z?et0%I}P*g%8<-?3AC<=#zQY>Z*R{}9W7(xkU$+8L|IZ2L?VRodDM61-IRusXY z1=K1i6;z<2tT=EYI7%E$uTn)TLzGdg_5`ff+TQ!)B>CRwd7tlH-*>VxJS=FsoT4Oonhuz6illC~ull#AKyF zQXm=P!U8JTU()~rFq;a-x-$q25gp>eOV@~@s5N2HtTibtPc}$fV(G1rUJ9UBNP5MY7@J0kr#1Zg+rAuMXztD}y2XqlnC>2V0Lebj<-rM3W z{DC7!EG`AjYp3$vxX zw_5M)p^$+4cfc4~s?6BhWdazEVGT;U=~~+D1WqVUEh5DMeT$0*Q)yRQ{nLm z2Y~TDQn z<9!bW4?@)bJvaQD$neH9_h)F{_z!~j9w+?ekRpB)HstUlw+R02HG(YOUPO=pxqZaQ zHS-i5V2(nWXknx+AG8C7a?O@yx48L7V9wLXyt9OFlbJ*~Zu(dR+CEEXXPKpon7m8J z%_tcgTqAU0{B$WMBKh9UwGEoX$6~%+dNJ4isBepk97Vp^-bQ^OX&Bjkqwc|4_ngS< zYhD6BkUg>8Bb1q^v%=b}JSa!A_?ul%QtWq6i;#TP$s)ewH^i69+Z*<&<{xlNf-w%U z(b!MD=X+P=Mlm{V`@*+ne|(qBJnk|RQ%`=*+nC4*%NcEBV=)8TD#k5c$$xnty9Hyh z3-RZ7g!Sxrn%8cxXOwukqp{^ymQL?9Mowm($3A*Q)zApA0>?5K;!l z?AM(8Z0ffAqOAP9N5sL^*I1+|Ow+5^Pf8seXW^C|Pup|%HlZ`^)KAlC%QpiFjmU%C z9!Z!3P>D;FO;3Aq_0z#EJ&8{9x#w~ZmaCBW#Z=MKcnJ!Hb2dIE%KbDs3N)EHjj<1!v7V+q3yO{qoz8CDKBC5QSBIKTuCSUhc1=cAgiv|Dds_~Y&&1tG7s_P( zdk&W!>tK| z4-9_xJJB$-B7Ucj;iN{0TCVpXY%29<{}$-O0lSau85gQLx*CO*bXJtU-Mrl}DTA!B z(XQxbY@6$R*SvsNskSe|YpuGMe~H(+Ih$^dmu=e_=;N_uN_d-z)JADlOTL|@w!i-C z+GcGN7lXo^jm{cqz3*M{xGvlF;I@ZgH-}urOSc$x($`y9YaO*_Nwg`R+El;qa^{Lm z6Sc23YSt_4qX)%9NjInb+{DS;dv_fw1M^g}^_GqJ49e-rP3xm_U#}yM60RxrPUfig z(w>Yh8okh>dL8Pe)qvZ8)2j?e)P|fh*ef?pb;eWl=8Afn=QON9 zXW-0=yskG~;tcr=`YRR@{RFbqh7?;-Ti&o@LEFNb*E7U+Emb{P(-vI5Vf{V&L_%X` z8?bloSiMz!we^a^bJAgLp=*9#@0^IxRauRvxL`pLY=Ie=cW08Ve(LBv0mTCI#gOgj z=5u|SO$8g8=zc3dcllu{_9N%~3e-R)2mN#Hch&<-HrFiA{beX_pQ|v>#o+35sqy5# zhbDFIyMRLN99ho;i-pBA9)U;W;}w}MC)2h%qeV8AbMc?GWEYMoVtjorMV0LsDvdeR zdB^&W7eJnU-9K)uci9$)Cw631%Vv zM~r4LJ}TJ!+i&RGyiOB~z7DedVnh8gcl;*J?8L4s7qSG50iHRI zm*B|t<@s-K#z{)7tM^pK*0zcRqR^GA?q}rd72Wyr$MoLHRVI^mLF;H{VaZp}&RZG0 zy`YWX>(YYHaFuU;_ zE{Rp;c5N@M-@kZ0`VKMyUzvo#H3PZBHB;CFRT%oIKCQgEJY6-Iqwg4+6>z2yPFX2e zhp;FL=?~p{JlwZg{I8# zP0%md)a@RvPpiLa>?Gd)e%P`(je5c>-S67)R7UNIqF`q>rM29>#a1IvT(VtknzpE8 z9o%J6X*Lss{oMOe$PhYP5o4w3Lxo=}r7sw`)^6TYhxdFS$!Q@*+WV*&+CO;4r)O zG&IZn*^4>d26+3SNsDQ8@F{P^dQI6S;WZ3^cG5P#?f}&5TdMln^@$<+E=AFbSc@39 l=9y*q+*Xn*m^89?kVb7wyP&QT35|c$g9F0+%lwko{sAhX-17hc literal 0 HcmV?d00001 diff --git a/app/Settings.cs b/app/Settings.cs index 0b4d9a10..8f93c00f 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1131,7 +1131,31 @@ namespace GHelper if (sender == buttonPeripheral2) index = 1; if (sender == buttonPeripheral3) index = 2; - //TODO: Open Configuration Panel + IPeripheral iph = PeripheralsProvider.AllPeripherals().ElementAt(index); + + if (iph is null) + { + //Can only happen when the user hits the button in the exact moment a device is disconnected. + return; + } + + if (iph.DeviceType() == PeripheralType.Mouse) + { + AsusMouse? am = iph as AsusMouse; + if (am is null) + { + //Should not happen if all device classes are implemented correctly. But better safe than sorry. + return; + } + AsusMouseSettings s = new AsusMouseSettings(am); + if (!s.IsDisposed) + { + s.Show(); + } + + } + + } } From 3c1b61dc82535b4a8cc3c90368d363fb4acaf1bc Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 18:53:21 +0200 Subject: [PATCH 18/34] This can be simplified to reduce redundant code. --- app/Peripherals/Mouse/AsusMouse.cs | 12 +++++++++--- app/Peripherals/Mouse/Models/ChakramX.cs | 25 ------------------------ 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 2f549a4a..5f72029d 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -1,6 +1,5 @@ using GHelper.AnimeMatrix.Communication; using GHelper.AnimeMatrix.Communication.Platform; -using System; using System.Runtime.CompilerServices; using System.Text; @@ -454,8 +453,15 @@ namespace GHelper.Peripherals.Mouse return false; } - public abstract string PollingRateDisplayString(int pollingRate); - public abstract int PollingRateCount(); + public virtual string PollingRateDisplayString(int pollingRate) + { + return PollingRateDisplayStrings()[pollingRate -1]; + } + + public virtual int PollingRateCount() + { + return PollingRateDisplayStrings().Length; + } public abstract string[] PollingRateDisplayStrings(); diff --git a/app/Peripherals/Mouse/Models/ChakramX.cs b/app/Peripherals/Mouse/Models/ChakramX.cs index 425c1234..8f5eca9a 100644 --- a/app/Peripherals/Mouse/Models/ChakramX.cs +++ b/app/Peripherals/Mouse/Models/ChakramX.cs @@ -18,16 +18,6 @@ namespace GHelper.Peripherals.Mouse.Models return "ROG Chakram X (Wireless)"; } - public override string PollingRateDisplayString(int pollingRate) - { - if (pollingRate >= 1 && pollingRate <= POLLING_RATES.Length) - { - return POLLING_RATES[pollingRate - 1]; - } - - return "Unknown"; - } - public override string[] PollingRateDisplayStrings() { return POLLING_RATES; @@ -38,11 +28,6 @@ namespace GHelper.Peripherals.Mouse.Models return true; } - public override int PollingRateCount() - { - return 3; - } - public override int ProfileCount() { return 5; @@ -87,16 +72,6 @@ namespace GHelper.Peripherals.Mouse.Models return "ROG Chakram X (Wired)"; } - public override string PollingRateDisplayString(int pollingRate) - { - if (pollingRate >= 1 && pollingRate <= POLLING_RATES.Length) - { - return POLLING_RATES[pollingRate - 1]; - } - - return "Unknown"; - } - public override string[] PollingRateDisplayStrings() { return POLLING_RATES; From 6f70b54cd4a76f6363ac6afac7491b4d9a154192 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 18:55:24 +0200 Subject: [PATCH 19/34] Unregister event handlers on close --- app/AsusMouseSettings.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index 7c5dfc72..f19a1260 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -47,6 +47,7 @@ namespace GHelper this.Text = mouse.GetDisplayName(); Shown += AsusMouseSettings_Shown; + FormClosing += AsusMouseSettings_FormClosing; mouse.Disconnect += Mouse_Disconnect; mouse.BatteryUpdated += Mouse_BatteryUpdated; @@ -81,6 +82,12 @@ namespace GHelper RefreshMouseData(); } + private void AsusMouseSettings_FormClosing(object? sender, FormClosingEventArgs e) + { + mouse.BatteryUpdated -= Mouse_BatteryUpdated; + mouse.Disconnect -= Mouse_Disconnect; + } + private void Mouse_BatteryUpdated(object? sender, EventArgs e) { this.Invoke(delegate From d4b0b484aa9475831c093545d32aaf2e985ca337 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 18:57:02 +0200 Subject: [PATCH 20/34] Added Gladius III (P711) experimental class. --- app/Peripherals/Mouse/Models/P711.cs | 81 ++++++++++++++++++++++++++ app/Peripherals/PeripheralsProvider.cs | 2 + 2 files changed, 83 insertions(+) create mode 100644 app/Peripherals/Mouse/Models/P711.cs diff --git a/app/Peripherals/Mouse/Models/P711.cs b/app/Peripherals/Mouse/Models/P711.cs new file mode 100644 index 00000000..3b850be4 --- /dev/null +++ b/app/Peripherals/Mouse/Models/P711.cs @@ -0,0 +1,81 @@ +namespace GHelper.Peripherals.Mouse.Models +{ + public class P711 : AsusMouse + { + private static string[] POLLING_RATES = { "125Hz", "250Hz", "500Hz", "1000Hz" }; + + public P711() : base(0x0B05, 0x1A70, "mi_01", true) + { + } + + protected P711(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_01", wireless) + { + } + + public override int DPIProfileCount() + { + return 4; + } + + public override string GetDisplayName() + { + return "ROG Gladius III (Wireless)"; + } + + + public override string[] PollingRateDisplayStrings() + { + return POLLING_RATES; + } + + public override int ProfileCount() + { + throw new NotImplementedException(); + } + public override int MaxDPI() + { + return 36_000; + } + + public override bool HasLiftOffSetting() + { + return true; + } + + public override bool HasRGB() + { + return true; + } + + public override bool HasEnergySettings() + { + return true; + } + + public override bool HasAngleSnapping() + { + return true; + } + + public override bool IsLightingModeSupported(LightingMode lightingMode) + { + return lightingMode == LightingMode.Static + || lightingMode == LightingMode.Breathing + || lightingMode == LightingMode.ColorCycle + || lightingMode == LightingMode.React + || lightingMode == LightingMode.BatteryState; + } + } + + public class P711Wired : P711 + { + public P711Wired() : base(0x1A72, false) + { + } + + public override string GetDisplayName() + { + return "ROG Gladius III (Wired)"; + } + } +} diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 29851872..69dc658c 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -138,6 +138,8 @@ namespace GHelper.Peripherals //Add one line for every supported mouse class here to support them. DetectMouse(new ChakramX()); DetectMouse(new ChakramXWired()); + DetectMouse(new P711()); + DetectMouse(new P711Wired()); } public static void DetectMouse(AsusMouse am) From f0eadd46286634b2ca94cdbfde5bbfdbd28e42ad Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 18:58:38 +0200 Subject: [PATCH 21/34] Show charging in brackets. --- app/AsusMouseSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index f19a1260..6e226baf 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -39,7 +39,7 @@ namespace GHelper buttonSync.Text = Properties.Strings.MouseSynchronize; checkBoxAngleSnapping.Text = Properties.Strings.MouseAngleSnapping; labelLiftOffDistance.Text = Properties.Strings.MouseLiftOffDistance; - labelChargingState.Text = Properties.Strings.Charging; + labelChargingState.Text = "(" + Properties.Strings.Charging + ")"; labelProfile.Text = Properties.Strings.Profile; InitTheme(); From 217074c640b92d9d7a7ff04f1f595ce339fbaf48 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 23 Jul 2023 20:52:36 +0200 Subject: [PATCH 22/34] P711 apparently supports all modes even though Armoury Crate does not list them all (as per OpenRGB) --- app/Peripherals/Mouse/Models/P711.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/Peripherals/Mouse/Models/P711.cs b/app/Peripherals/Mouse/Models/P711.cs index 3b850be4..3d2d57ec 100644 --- a/app/Peripherals/Mouse/Models/P711.cs +++ b/app/Peripherals/Mouse/Models/P711.cs @@ -56,15 +56,6 @@ { return true; } - - public override bool IsLightingModeSupported(LightingMode lightingMode) - { - return lightingMode == LightingMode.Static - || lightingMode == LightingMode.Breathing - || lightingMode == LightingMode.ColorCycle - || lightingMode == LightingMode.React - || lightingMode == LightingMode.BatteryState; - } } public class P711Wired : P711 From 3b5cfe958dfbb0fac39b8913885ef8d85a9fb3d9 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 14:14:09 +0200 Subject: [PATCH 23/34] Polling rates are fixed index numbers for all mice. 0 is immer 125Hz for example, if the mouse, like the Ckakram, do not support 125Hz, the first valid polling rate is 250Hz = 1. --- app/AsusMouseSettings.cs | 15 +++++-- app/Peripherals/Mouse/AsusMouse.cs | 56 +++++++++++++++++++----- app/Peripherals/Mouse/Models/ChakramX.cs | 22 +++++++--- app/Peripherals/Mouse/Models/P711.cs | 11 +++-- 4 files changed, 78 insertions(+), 26 deletions(-) diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index 6e226baf..8f1c816a 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -105,7 +105,7 @@ namespace GHelper private void ComboBoxPollingRate_DropDownClosed(object? sender, EventArgs e) { - mouse.SetPollingRate(comboBoxPollingRate.SelectedIndex + 1); + mouse.SetPollingRate(mouse.SupportedPollingrates()[comboBoxPollingRate.SelectedIndex]); } private void ButtonDPIColor_Click(object? sender, EventArgs e) @@ -337,7 +337,11 @@ namespace GHelper if (mouse.CanSetPollingRate()) { - comboBoxPollingRate.Items.AddRange(mouse.PollingRateDisplayStrings()); + foreach(PollingRate pr in mouse.SupportedPollingrates()) + { + comboBoxPollingRate.Items.Add(mouse.PollingRateDisplayString(pr)); + } + } else { @@ -433,7 +437,12 @@ namespace GHelper if (mouse.CanSetPollingRate()) { - comboBoxPollingRate.SelectedIndex = mouse.PollingRate - 1; + int idx = mouse.PollingRateIndex(mouse.PollingRate); + if(idx == -1) + { + return; + } + comboBoxPollingRate.SelectedIndex = idx; } if (mouse.HasAngleSnapping()) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 5f72029d..90e7e09e 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -15,6 +15,18 @@ namespace GHelper.Peripherals.Mouse Never = 0xFF } + public enum PollingRate + { + PR125Hz = 0, + PR250Hz = 1, + PR500Hz = 2, + PR1000Hz = 3, + PR2000Hz = 4, + PR4000Hz = 5, + PR8000Hz = 6, + PR16000Hz = 7 //for whenever that gets supported lol + } + public enum LiftOffDistance { Low = 0, @@ -88,6 +100,8 @@ namespace GHelper.Peripherals.Mouse public abstract class AsusMouse : Device, IPeripheral { + private static string[] POLLING_RATES = { "125 Hz", "250 Hz", "500 Hz", "1000 Hz", "2000 Hz", "4000 Hz", "8000 Hz", "16000 Hz" }; + internal const int ASUS_MOUSE_PACKET_SIZE = 65; public event EventHandler? Disconnect; @@ -106,7 +120,7 @@ namespace GHelper.Peripherals.Mouse public int DpiProfile { get; protected set; } public AsusMouseDPI[] DpiSettings { get; protected set; } public int Profile { get; protected set; } - public int PollingRate { get; protected set; } + public PollingRate PollingRate { get; protected set; } public bool AngleSnapping { get; protected set; } public short AngleAdjustmentDegrees { get; protected set; } @@ -453,17 +467,35 @@ namespace GHelper.Peripherals.Mouse return false; } - public virtual string PollingRateDisplayString(int pollingRate) + public virtual string PollingRateDisplayString(PollingRate pollingRate) { - return PollingRateDisplayStrings()[pollingRate -1]; + return POLLING_RATES[(int)pollingRate]; } public virtual int PollingRateCount() { - return PollingRateDisplayStrings().Length; + return SupportedPollingrates().Length; } - public abstract string[] PollingRateDisplayStrings(); + public virtual int PollingRateIndex(PollingRate pollingRate) + { + for (int i = 0; i < PollingRateCount(); ++i) + { + if (SupportedPollingrates()[i] == pollingRate) + { + return i; + } + } + return -1; + } + + + public virtual bool IsPollingRateSupported(PollingRate pollingRate) + { + return SupportedPollingrates().Contains(pollingRate); + } + + public abstract PollingRate[] SupportedPollingrates(); public virtual bool CanSetPollingRate() { @@ -475,7 +507,7 @@ namespace GHelper.Peripherals.Mouse return new byte[] { 0x00, 0x12, 0x04, 0x00 }; } - protected virtual byte[] GetUpdatePollingRatePacket(int pollingRate) + protected virtual byte[] GetUpdatePollingRatePacket(PollingRate pollingRate) { return new byte[] { 0x00, 0x51, 0x31, 0x04, 0x00, (byte)pollingRate }; } @@ -488,14 +520,14 @@ namespace GHelper.Peripherals.Mouse return new byte[] { 0x00, 0x51, 0x31, 0x0B, 0x00, (byte)(angleAdjustment & 0xFF), (byte)((angleAdjustment >> 8) & 0xFF) }; } - protected virtual int ParsePollingRate(byte[] packet) + protected virtual PollingRate ParsePollingRate(byte[] packet) { if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) { - return packet[13]; + return (PollingRate)packet[13]; } - return -1; + return PollingRate.PR125Hz; } protected virtual bool ParseAngleSnapping(byte[] packet) @@ -539,16 +571,16 @@ namespace GHelper.Peripherals.Mouse } } - public void SetPollingRate(int pollingRate) + public void SetPollingRate(PollingRate pollingRate) { if (!CanSetPollingRate()) { return; } - if (pollingRate > PollingRateCount() || pollingRate < 1) + if (!IsPollingRateSupported(pollingRate)) { - Logger.WriteLine(GetDisplayName() + ": Pollingrate:" + pollingRate + " is invalid."); + Logger.WriteLine(GetDisplayName() + ": Pollingrate:" + pollingRate + " is not supported by this mouse."); return; } diff --git a/app/Peripherals/Mouse/Models/ChakramX.cs b/app/Peripherals/Mouse/Models/ChakramX.cs index 8f5eca9a..7a96116c 100644 --- a/app/Peripherals/Mouse/Models/ChakramX.cs +++ b/app/Peripherals/Mouse/Models/ChakramX.cs @@ -3,8 +3,6 @@ namespace GHelper.Peripherals.Mouse.Models { public class ChakramX : AsusMouse { - private static string[] POLLING_RATES = { "250Hz", "500Hz", "1000Hz" }; - public ChakramX() : base(0x0B05, 0x1A1A, "mi_00", true) { } @@ -18,9 +16,13 @@ namespace GHelper.Peripherals.Mouse.Models return "ROG Chakram X (Wireless)"; } - public override string[] PollingRateDisplayStrings() + public override PollingRate[] SupportedPollingrates() { - return POLLING_RATES; + return new PollingRate[] { + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz + }; } public override bool HasAngleSnapping() @@ -62,7 +64,6 @@ namespace GHelper.Peripherals.Mouse.Models public class ChakramXWired : ChakramX { - private static string[] POLLING_RATES = { "250Hz", "500Hz", "1000Hz", "2000Hz", "4000Hz", "8000Hz" }; public ChakramXWired() : base(0x1A18, false) { } @@ -72,9 +73,16 @@ namespace GHelper.Peripherals.Mouse.Models return "ROG Chakram X (Wired)"; } - public override string[] PollingRateDisplayStrings() + public override PollingRate[] SupportedPollingrates() { - return POLLING_RATES; + return new PollingRate[] { + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz, + PollingRate.PR2000Hz, + PollingRate.PR4000Hz, + PollingRate.PR8000Hz + }; } } } diff --git a/app/Peripherals/Mouse/Models/P711.cs b/app/Peripherals/Mouse/Models/P711.cs index 3d2d57ec..fae8f775 100644 --- a/app/Peripherals/Mouse/Models/P711.cs +++ b/app/Peripherals/Mouse/Models/P711.cs @@ -2,8 +2,6 @@ { public class P711 : AsusMouse { - private static string[] POLLING_RATES = { "125Hz", "250Hz", "500Hz", "1000Hz" }; - public P711() : base(0x0B05, 0x1A70, "mi_01", true) { } @@ -23,9 +21,14 @@ } - public override string[] PollingRateDisplayStrings() + public override PollingRate[] SupportedPollingrates() { - return POLLING_RATES; + return new PollingRate[] { + PollingRate.PR125Hz, + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz + }; } public override int ProfileCount() From 4d686b61152e47e4a72065fae2f27feca9ef85b4 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 14:14:43 +0200 Subject: [PATCH 24/34] Fixed IDs for P711. It's apparently always mi_00. Even if the ASUS driver lists something else. --- app/Peripherals/Mouse/Models/P711.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Peripherals/Mouse/Models/P711.cs b/app/Peripherals/Mouse/Models/P711.cs index fae8f775..06d4fb09 100644 --- a/app/Peripherals/Mouse/Models/P711.cs +++ b/app/Peripherals/Mouse/Models/P711.cs @@ -2,11 +2,11 @@ { public class P711 : AsusMouse { - public P711() : base(0x0B05, 0x1A70, "mi_01", true) + public P711() : base(0x0B05, 0x1A70, "mi_00", true) { } - protected P711(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_01", wireless) + protected P711(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_00", wireless) { } From 93ad46a685427497d4cab4ad7b8368161059bc6a Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 14:14:57 +0200 Subject: [PATCH 25/34] Well.. this should've been implemented already. --- app/Peripherals/Mouse/Models/P711.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Peripherals/Mouse/Models/P711.cs b/app/Peripherals/Mouse/Models/P711.cs index 06d4fb09..adadae84 100644 --- a/app/Peripherals/Mouse/Models/P711.cs +++ b/app/Peripherals/Mouse/Models/P711.cs @@ -33,7 +33,7 @@ public override int ProfileCount() { - throw new NotImplementedException(); + return 5; } public override int MaxDPI() { From 03a942b57ec93cdd820c9638964482f7740f85a5 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 15:29:03 +0200 Subject: [PATCH 26/34] Support for proper "Off" Lighting mode --- app/AsusMouseSettings.cs | 1 + app/Peripherals/Mouse/AsusMouse.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index 8f1c816a..89890286 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -15,6 +15,7 @@ namespace GHelper { LightingMode.React, Properties.Strings.AuraReact}, { LightingMode.Comet, Properties.Strings.AuraComet}, { LightingMode.BatteryState, Properties.Strings.AuraBatteryState}, + { LightingMode.Off, Properties.Strings.MatrixOff}, }; private List supportedLightingModes = new List(); diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 90e7e09e..1752cc2c 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -46,6 +46,7 @@ namespace GHelper.Peripherals.Mouse } public enum LightingMode { + Off = 0xF0, Static = 0x0, Breathing = 0x1, ColorCycle = 0x2, @@ -873,6 +874,11 @@ namespace GHelper.Peripherals.Mouse //Also override this for the reverse mapping protected virtual LightingMode LightingModeForIndex(byte lightingMode) { + //We do not support other mods. we treat them as off. True off is actually 0xF0. + if (lightingMode > 0x06) + { + return LightingMode.Off; + } return ((LightingMode)lightingMode); } From badbb174cd2b619939abbfa85626a64becef11a2 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 15:29:21 +0200 Subject: [PATCH 27/34] Also hide the color button if colors cannot be set --- app/AsusMouseSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index 89890286..10980180 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -513,7 +513,7 @@ namespace GHelper checkBoxRandomColor.Visible = mouse.SupportsRandomColor(ls.LightingMode); pictureBoxLightingColor.Visible = mouse.SupportsColorSetting(ls.LightingMode); - pictureBoxLightingColor.Visible = mouse.SupportsColorSetting(ls.LightingMode); + buttonLightingColor.Visible = mouse.SupportsColorSetting(ls.LightingMode); comboBoxAnimationSpeed.Visible = mouse.SupportsAnimationSpeed(ls.LightingMode); labelAnimationSpeed.Visible = mouse.SupportsAnimationSpeed(ls.LightingMode); From 966f9107fb73bdf74723f1b228c9b0fb0adddde1 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 15:29:56 +0200 Subject: [PATCH 28/34] Code re-format --- app/AsusMouseSettings.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index 10980180..d3348afc 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -338,11 +338,11 @@ namespace GHelper if (mouse.CanSetPollingRate()) { - foreach(PollingRate pr in mouse.SupportedPollingrates()) + foreach (PollingRate pr in mouse.SupportedPollingrates()) { comboBoxPollingRate.Items.Add(mouse.PollingRateDisplayString(pr)); } - + } else { @@ -439,7 +439,7 @@ namespace GHelper if (mouse.CanSetPollingRate()) { int idx = mouse.PollingRateIndex(mouse.PollingRate); - if(idx == -1) + if (idx == -1) { return; } @@ -526,7 +526,6 @@ namespace GHelper { checkBoxRandomColor.Checked = ls.RandomColor; buttonLightingColor.Visible = !ls.RandomColor; - } if (ls.RandomColor && mouse.SupportsRandomColor(ls.LightingMode)) From 5c065a385713d19aa325e3e3ce9061b70e705dfe Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 16:20:16 +0200 Subject: [PATCH 29/34] Fixed crash if speed is reported as 0. --- app/Peripherals/Mouse/AsusMouse.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 1752cc2c..b2f54c4a 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -956,6 +956,13 @@ namespace GHelper.Peripherals.Mouse setting.RandomColor = packet[12] == 0x01; setting.AnimationSpeed = (AnimationSpeed)packet[13]; + //If the mouse reports 0, which it does when the current setting has no speed option, chose medium as default + if (setting.AnimationSpeed != AnimationSpeed.Fast + && setting.AnimationSpeed != AnimationSpeed.Medium + && setting.AnimationSpeed != AnimationSpeed.Slow) + { + setting.AnimationSpeed = AnimationSpeed.Medium; + } return setting; } From 150c2c75d622c576da2dbe6a718f8b6130249f6d Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 16:33:23 +0200 Subject: [PATCH 30/34] Put image to the side to have more space for text --- app/Settings.Designer.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index cd9781cf..1a3f9460 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -1207,15 +1207,15 @@ namespace GHelper buttonPeripheral3.FlatStyle = FlatStyle.Flat; buttonPeripheral3.Font = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point); buttonPeripheral3.ForeColor = SystemColors.ControlText; - buttonPeripheral3.Image = Properties.Resources.icons8_maus_32; - buttonPeripheral3.ImageAlign = ContentAlignment.BottomCenter; + buttonPeripheral3.Image = Properties.Resources.icons8_maus_48; + buttonPeripheral3.ImageAlign = ContentAlignment.MiddleLeft; buttonPeripheral3.Location = new Point(397, 3); buttonPeripheral3.Name = "buttonPeripheral3"; buttonPeripheral3.Secondary = false; buttonPeripheral3.Size = new Size(191, 110); buttonPeripheral3.TabIndex = 22; buttonPeripheral3.Text = "Mouse 3"; - buttonPeripheral3.TextImageRelation = TextImageRelation.ImageAboveText; + buttonPeripheral3.TextImageRelation = TextImageRelation.ImageBeforeText; buttonPeripheral3.UseVisualStyleBackColor = false; // // buttonPeripheral2 @@ -1231,15 +1231,15 @@ namespace GHelper buttonPeripheral2.FlatStyle = FlatStyle.Flat; buttonPeripheral2.Font = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point); buttonPeripheral2.ForeColor = SystemColors.ControlText; - buttonPeripheral2.Image = Properties.Resources.icons8_maus_32; - buttonPeripheral2.ImageAlign = ContentAlignment.BottomCenter; + buttonPeripheral2.Image = Properties.Resources.icons8_maus_48; + buttonPeripheral2.ImageAlign = ContentAlignment.MiddleLeft; buttonPeripheral2.Location = new Point(200, 3); buttonPeripheral2.Name = "buttonPeripheral2"; buttonPeripheral2.Secondary = false; buttonPeripheral2.Size = new Size(191, 110); buttonPeripheral2.TabIndex = 19; buttonPeripheral2.Text = "Mouse 2"; - buttonPeripheral2.TextImageRelation = TextImageRelation.ImageAboveText; + buttonPeripheral2.TextImageRelation = TextImageRelation.ImageBeforeText; buttonPeripheral2.UseVisualStyleBackColor = false; // // buttonPeripheral1 @@ -1255,15 +1255,15 @@ namespace GHelper buttonPeripheral1.FlatStyle = FlatStyle.Flat; buttonPeripheral1.Font = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point); buttonPeripheral1.ForeColor = SystemColors.ControlText; - buttonPeripheral1.Image = Properties.Resources.icons8_maus_32; - buttonPeripheral1.ImageAlign = ContentAlignment.BottomCenter; + buttonPeripheral1.Image = Properties.Resources.icons8_maus_48; + buttonPeripheral1.ImageAlign = ContentAlignment.MiddleLeft; buttonPeripheral1.Location = new Point(3, 3); buttonPeripheral1.Name = "buttonPeripheral1"; buttonPeripheral1.Secondary = false; buttonPeripheral1.Size = new Size(191, 110); buttonPeripheral1.TabIndex = 20; buttonPeripheral1.Text = "Mouse 1"; - buttonPeripheral1.TextImageRelation = TextImageRelation.ImageAboveText; + buttonPeripheral1.TextImageRelation = TextImageRelation.ImageBeforeText; buttonPeripheral1.UseVisualStyleBackColor = false; // // panelPeripheralsTile From f70285c0171621598bd0046d9211cca8bfaa1746 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 18:04:46 +0200 Subject: [PATCH 31/34] Allow DPI changes via text input --- app/AsusMouseSettings.Designer.cs | 64 +++++++++++++++++-------------- app/AsusMouseSettings.cs | 30 ++++++++++++++- app/UI/ControlHelper.cs | 6 +++ 3 files changed, 70 insertions(+), 30 deletions(-) diff --git a/app/AsusMouseSettings.Designer.cs b/app/AsusMouseSettings.Designer.cs index 3cbed06e..c9323e25 100644 --- a/app/AsusMouseSettings.Designer.cs +++ b/app/AsusMouseSettings.Designer.cs @@ -44,8 +44,8 @@ sliderDPI = new UI.Slider(); tableLayoutPanel1 = new TableLayoutPanel(); labelMinDPI = new Label(); - labelDPIValue = new Label(); labelMaxDPI = new Label(); + numericUpDownCurrentDPI = new NumericUpDown(); panelDPITile = new Panel(); pictureDPIColor = new PictureBox(); buttonDPIColor = new UI.RButton(); @@ -94,6 +94,7 @@ panelPerformanceOther.SuspendLayout(); panelDPISettings.SuspendLayout(); tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)numericUpDownCurrentDPI).BeginInit(); panelDPITile.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureDPIColor).BeginInit(); tableDPI.SuspendLayout(); @@ -159,7 +160,7 @@ panelPerformance.Location = new Point(11, 68); panelPerformance.Name = "panelPerformance"; panelPerformance.Padding = new Padding(0, 11, 0, 25); - panelPerformance.Size = new Size(654, 401); + panelPerformance.Size = new Size(654, 408); panelPerformance.TabIndex = 1; // // panelPerformanceOther @@ -174,7 +175,7 @@ panelPerformanceOther.Controls.Add(comboBoxPollingRate); panelPerformanceOther.Controls.Add(labelPollingRate); panelPerformanceOther.Dock = DockStyle.Top; - panelPerformanceOther.Location = new Point(0, 233); + panelPerformanceOther.Location = new Point(0, 240); panelPerformanceOther.Name = "panelPerformanceOther"; panelPerformanceOther.Padding = new Padding(0, 11, 0, 11); panelPerformanceOther.Size = new Size(654, 143); @@ -270,14 +271,14 @@ panelDPISettings.Dock = DockStyle.Top; panelDPISettings.Location = new Point(0, 137); panelDPISettings.Name = "panelDPISettings"; - panelDPISettings.Size = new Size(654, 96); + panelDPISettings.Size = new Size(654, 103); panelDPISettings.TabIndex = 44; // // sliderDPI // sliderDPI.AccessibleName = "DPI Slider"; sliderDPI.Dock = DockStyle.Top; - sliderDPI.Location = new Point(0, 66); + sliderDPI.Location = new Point(0, 73); sliderDPI.Max = 35000; sliderDPI.Min = 100; sliderDPI.Name = "sliderDPI"; @@ -293,54 +294,58 @@ tableLayoutPanel1.AutoSize = true; tableLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink; tableLayoutPanel1.ColumnCount = 3; - tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); - tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); - tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); + tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 38F)); + tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 24F)); + tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 38F)); tableLayoutPanel1.Controls.Add(labelMinDPI, 0, 0); - tableLayoutPanel1.Controls.Add(labelDPIValue, 1, 0); tableLayoutPanel1.Controls.Add(labelMaxDPI, 2, 0); + tableLayoutPanel1.Controls.Add(numericUpDownCurrentDPI, 1, 0); tableLayoutPanel1.Dock = DockStyle.Top; tableLayoutPanel1.GrowStyle = TableLayoutPanelGrowStyle.FixedSize; tableLayoutPanel1.Location = new Point(0, 40); tableLayoutPanel1.Name = "tableLayoutPanel1"; tableLayoutPanel1.RowCount = 1; tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - tableLayoutPanel1.Size = new Size(654, 26); + tableLayoutPanel1.Size = new Size(654, 33); tableLayoutPanel1.TabIndex = 47; // // labelMinDPI // + labelMinDPI.Dock = DockStyle.Fill; labelMinDPI.ForeColor = SystemColors.GrayText; labelMinDPI.Location = new Point(6, 0); labelMinDPI.Margin = new Padding(6, 0, 6, 0); labelMinDPI.Name = "labelMinDPI"; - labelMinDPI.Size = new Size(105, 26); + labelMinDPI.Size = new Size(236, 33); labelMinDPI.TabIndex = 45; labelMinDPI.Text = "100"; // - // labelDPIValue - // - labelDPIValue.Anchor = AnchorStyles.Top; - labelDPIValue.Location = new Point(271, 0); - labelDPIValue.Margin = new Padding(6, 0, 6, 0); - labelDPIValue.Name = "labelDPIValue"; - labelDPIValue.Size = new Size(111, 26); - labelDPIValue.TabIndex = 44; - labelDPIValue.Text = "2000"; - labelDPIValue.TextAlign = ContentAlignment.TopCenter; - // // labelMaxDPI // - labelMaxDPI.Anchor = AnchorStyles.Top | AnchorStyles.Right; + labelMaxDPI.Dock = DockStyle.Fill; labelMaxDPI.ForeColor = SystemColors.GrayText; - labelMaxDPI.Location = new Point(543, 0); + labelMaxDPI.Location = new Point(410, 0); labelMaxDPI.Margin = new Padding(6, 0, 6, 0); labelMaxDPI.Name = "labelMaxDPI"; - labelMaxDPI.Size = new Size(105, 26); + labelMaxDPI.Size = new Size(238, 33); labelMaxDPI.TabIndex = 46; labelMaxDPI.Text = " 35000"; labelMaxDPI.TextAlign = ContentAlignment.TopRight; // + // numericUpDownCurrentDPI + // + numericUpDownCurrentDPI.BorderStyle = BorderStyle.None; + numericUpDownCurrentDPI.Dock = DockStyle.Fill; + numericUpDownCurrentDPI.Increment = new decimal(new int[] { 50, 0, 0, 0 }); + numericUpDownCurrentDPI.Location = new Point(251, 3); + numericUpDownCurrentDPI.Maximum = new decimal(new int[] { 35000, 0, 0, 0 }); + numericUpDownCurrentDPI.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); + numericUpDownCurrentDPI.Name = "numericUpDownCurrentDPI"; + numericUpDownCurrentDPI.Size = new Size(150, 27); + numericUpDownCurrentDPI.TabIndex = 47; + numericUpDownCurrentDPI.TextAlign = HorizontalAlignment.Center; + numericUpDownCurrentDPI.Value = new decimal(new int[] { 2000, 0, 0, 0 }); + // // panelDPITile // panelDPITile.Controls.Add(pictureDPIColor); @@ -545,7 +550,7 @@ panelLighting.Controls.Add(panelLightingContent); panelLighting.Controls.Add(panelLightingHeader); panelLighting.Dock = DockStyle.Top; - panelLighting.Location = new Point(11, 469); + panelLighting.Location = new Point(11, 476); panelLighting.Name = "panelLighting"; panelLighting.Padding = new Padding(0, 0, 0, 25); panelLighting.Size = new Size(654, 271); @@ -734,7 +739,7 @@ panelEnergy.Controls.Add(labelAutoPowerOff); panelEnergy.Controls.Add(panelEnergyHeader); panelEnergy.Dock = DockStyle.Top; - panelEnergy.Location = new Point(11, 740); + panelEnergy.Location = new Point(11, 747); panelEnergy.Name = "panelEnergy"; panelEnergy.Padding = new Padding(0, 0, 0, 25); panelEnergy.Size = new Size(654, 143); @@ -915,7 +920,7 @@ panelBottomButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelBottomButtons.Controls.Add(buttonSync); panelBottomButtons.Dock = DockStyle.Top; - panelBottomButtons.Location = new Point(11, 883); + panelBottomButtons.Location = new Point(11, 890); panelBottomButtons.Name = "panelBottomButtons"; panelBottomButtons.Size = new Size(654, 67); panelBottomButtons.TabIndex = 47; @@ -950,6 +955,7 @@ panelDPISettings.ResumeLayout(false); panelDPISettings.PerformLayout(); tableLayoutPanel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)numericUpDownCurrentDPI).EndInit(); panelDPITile.ResumeLayout(false); panelDPITile.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureDPIColor).EndInit(); @@ -1003,7 +1009,6 @@ private Panel panelDPISettings; private TableLayoutPanel tableLayoutPanel1; private Label labelMinDPI; - private Label labelDPIValue; private Label labelMaxDPI; private Panel panelDPITile; private Label labelDPI; @@ -1041,5 +1046,6 @@ private PictureBox pictureBoxBatteryState; private UI.RButton buttonSync; private Panel panelBottomButtons; + private NumericUpDown numericUpDownCurrentDPI; } } \ No newline at end of file diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index d3348afc..0076193a 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -22,6 +22,8 @@ namespace GHelper private readonly AsusMouse mouse; private readonly RButton[] dpiButtons; + private bool updateMouseDPI = true; + public AsusMouseSettings(AsusMouse mouse) { this.mouse = mouse; @@ -55,7 +57,9 @@ namespace GHelper comboProfile.DropDownClosed += ComboProfile_DropDownClosed; sliderDPI.ValueChanged += SliderDPI_ValueChanged; + numericUpDownCurrentDPI.ValueChanged += NumericUpDownCurrentDPI_ValueChanged; sliderDPI.MouseUp += SliderDPI_MouseUp; + sliderDPI.MouseDown += SliderDPI_MouseDown; buttonDPIColor.Click += ButtonDPIColor_Click; buttonDPI1.Click += ButtonDPI_Click; buttonDPI2.Click += ButtonDPI_Click; @@ -265,11 +269,32 @@ namespace GHelper private void SliderDPI_ValueChanged(object? sender, EventArgs e) { - labelDPIValue.Text = sliderDPI.Value.ToString(); + numericUpDownCurrentDPI.Value = sliderDPI.Value; + UpdateMouseDPISettings(); + } + + private void NumericUpDownCurrentDPI_ValueChanged(object? sender, EventArgs e) + { + sliderDPI.Value = (int)numericUpDownCurrentDPI.Value; + } + + private void SliderDPI_MouseDown(object? sender, MouseEventArgs e) + { + updateMouseDPI = false; } private void SliderDPI_MouseUp(object? sender, MouseEventArgs e) { + updateMouseDPI = true; + UpdateMouseDPISettings(); + } + + private void UpdateMouseDPISettings() + { + if (!updateMouseDPI) + { + return; + } AsusMouseDPI dpi = mouse.DpiSettings[mouse.DpiProfile - 1]; dpi.DPI = (uint)sliderDPI.Value; @@ -320,6 +345,9 @@ namespace GHelper sliderDPI.Max = mouse.MaxDPI(); sliderDPI.Min = mouse.MinDPI(); + numericUpDownCurrentDPI.Minimum = mouse.MinDPI(); + numericUpDownCurrentDPI.Maximum = mouse.MaxDPI(); + if (!mouse.HasDPIColors()) { diff --git a/app/UI/ControlHelper.cs b/app/UI/ControlHelper.cs index cfa62b72..d384497f 100644 --- a/app/UI/ControlHelper.cs +++ b/app/UI/ControlHelper.cs @@ -77,6 +77,12 @@ public static class ControlHelper combo.ButtonColor = RForm.buttonMain; combo.ArrowColor = RForm.foreMain; } + var numbericUpDown = control as NumericUpDown; + if(numbericUpDown is not null) + { + numbericUpDown.ForeColor = RForm.foreMain; + numbericUpDown.BackColor = RForm.buttonMain; + } var gb = control as GroupBox; if (gb != null) From fce0801f3bf7c9289b3f7f3c9effddd4832e3c5d Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 18:05:30 +0200 Subject: [PATCH 32/34] Smaller buttons for the mouse --- app/Settings.Designer.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 1a3f9460..ccbb9c88 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -274,7 +274,7 @@ namespace GHelper panelBattery.Controls.Add(sliderBattery); panelBattery.Controls.Add(panelBatteryTitle); panelBattery.Dock = DockStyle.Top; - panelBattery.Location = new Point(8, 974); + panelBattery.Location = new Point(8, 959); panelBattery.Margin = new Padding(0); panelBattery.Name = "panelBattery"; panelBattery.Padding = new Padding(15, 15, 15, 5); @@ -345,7 +345,7 @@ namespace GHelper panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelFooter.Controls.Add(tableButtons); panelFooter.Dock = DockStyle.Top; - panelFooter.Location = new Point(8, 1099); + panelFooter.Location = new Point(8, 1084); panelFooter.Margin = new Padding(0); panelFooter.Name = "panelFooter"; panelFooter.Padding = new Padding(20); @@ -1154,7 +1154,7 @@ namespace GHelper panelVersion.Controls.Add(labelVersion); panelVersion.Controls.Add(checkStartup); panelVersion.Dock = DockStyle.Top; - panelVersion.Location = new Point(8, 1057); + panelVersion.Location = new Point(8, 1042); panelVersion.Name = "panelVersion"; panelVersion.Size = new Size(621, 42); panelVersion.TabIndex = 6; @@ -1170,7 +1170,7 @@ namespace GHelper panelPeripherals.Margin = new Padding(0); panelPeripherals.Name = "panelPeripherals"; panelPeripherals.Padding = new Padding(15, 15, 15, 8); - panelPeripherals.Size = new Size(621, 169); + panelPeripherals.Size = new Size(621, 154); panelPeripherals.TabIndex = 4; // // tableLayoutPeripherals @@ -1191,7 +1191,7 @@ namespace GHelper tableLayoutPeripherals.Name = "tableLayoutPeripherals"; tableLayoutPeripherals.RowCount = 1; tableLayoutPeripherals.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - tableLayoutPeripherals.Size = new Size(591, 116); + tableLayoutPeripherals.Size = new Size(591, 101); tableLayoutPeripherals.TabIndex = 43; // // buttonPeripheral3 @@ -1212,7 +1212,7 @@ namespace GHelper buttonPeripheral3.Location = new Point(397, 3); buttonPeripheral3.Name = "buttonPeripheral3"; buttonPeripheral3.Secondary = false; - buttonPeripheral3.Size = new Size(191, 110); + buttonPeripheral3.Size = new Size(191, 95); buttonPeripheral3.TabIndex = 22; buttonPeripheral3.Text = "Mouse 3"; buttonPeripheral3.TextImageRelation = TextImageRelation.ImageBeforeText; @@ -1236,7 +1236,7 @@ namespace GHelper buttonPeripheral2.Location = new Point(200, 3); buttonPeripheral2.Name = "buttonPeripheral2"; buttonPeripheral2.Secondary = false; - buttonPeripheral2.Size = new Size(191, 110); + buttonPeripheral2.Size = new Size(191, 95); buttonPeripheral2.TabIndex = 19; buttonPeripheral2.Text = "Mouse 2"; buttonPeripheral2.TextImageRelation = TextImageRelation.ImageBeforeText; @@ -1260,7 +1260,7 @@ namespace GHelper buttonPeripheral1.Location = new Point(3, 3); buttonPeripheral1.Name = "buttonPeripheral1"; buttonPeripheral1.Secondary = false; - buttonPeripheral1.Size = new Size(191, 110); + buttonPeripheral1.Size = new Size(191, 95); buttonPeripheral1.TabIndex = 20; buttonPeripheral1.Text = "Mouse 1"; buttonPeripheral1.TextImageRelation = TextImageRelation.ImageBeforeText; From 90ba7b6c08ad5d42f8758c840c36797dbf7391bd Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 19:19:31 +0200 Subject: [PATCH 33/34] Added more features to be selected and deselected individually. Renamed the P711 to Gladius III. Mouse classes will be named by their product name, not their internal name to find them easier. --- app/AsusMouseSettings.cs | 26 ++++++++++++--- app/Peripherals/Mouse/AsusMouse.cs | 33 +++++++++++++++---- app/Peripherals/Mouse/Models/ChakramX.cs | 16 ++++++++- .../Mouse/Models/{P711.cs => GladiusIII.cs} | 27 +++++++++++---- app/Peripherals/PeripheralsProvider.cs | 4 +-- 5 files changed, 86 insertions(+), 20 deletions(-) rename app/Peripherals/Mouse/Models/{P711.cs => GladiusIII.cs} (65%) diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index 0076193a..93e44ee4 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -381,6 +381,10 @@ namespace GHelper if (!mouse.HasAngleSnapping()) { checkBoxAngleSnapping.Visible = false; + } + + if (!mouse.HasAngleTuning()) + { labelAngleAdjustmentValue.Visible = false; sliderAngleAdjustment.Visible = false; } @@ -411,7 +415,7 @@ namespace GHelper panelBatteryState.Visible = false; } - if (mouse.HasEnergySettings()) + if (mouse.HasAutoPowerOff()) { comboBoxAutoPowerOff.Items.AddRange(new string[]{ " 1 "+ Properties.Strings.Minute, @@ -422,7 +426,15 @@ namespace GHelper Properties.Strings.Never, }); } - else + + if (!mouse.HasLowBatteryWarning()) + { + labelLowBatteryWarning.Visible = false; + labelLowBatteryWarningValue.Visible = false; + sliderLowBatteryWarning.Visible = false; + } + + if (!mouse.HasAutoPowerOff() && !mouse.HasLowBatteryWarning()) { panelEnergy.Visible = false; } @@ -477,10 +489,14 @@ namespace GHelper if (mouse.HasAngleSnapping()) { checkBoxAngleSnapping.Checked = mouse.AngleSnapping; + } + + if (mouse.HasAngleTuning()) + { sliderAngleAdjustment.Value = mouse.AngleAdjustmentDegrees; } - if (mouse.HasEnergySettings()) + if (mouse.HasAutoPowerOff()) { if (mouse.PowerOffSetting == PowerOffSetting.Never) { @@ -490,9 +506,11 @@ namespace GHelper { comboBoxAutoPowerOff.SelectedIndex = (int)mouse.PowerOffSetting; } + } + if (mouse.HasLowBatteryWarning()) + { sliderLowBatteryWarning.Value = mouse.LowBatteryWarning; - } if (mouse.HasLiftOffSetting()) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index b2f54c4a..dfb2b656 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -276,7 +276,12 @@ namespace GHelper.Peripherals.Mouse return true; } - public virtual bool HasEnergySettings() + public virtual bool HasAutoPowerOff() + { + return false; + } + + public virtual bool HasLowBatteryWarning() { return false; } @@ -330,7 +335,7 @@ namespace GHelper.Peripherals.Mouse public void SetEnergySettings(int lowBatteryWarning, PowerOffSetting powerOff) { - if (!HasEnergySettings()) + if (!HasAutoPowerOff() && !HasLowBatteryWarning()) { return; } @@ -345,7 +350,7 @@ namespace GHelper.Peripherals.Mouse public void ReadBattery() { - if (!HasBattery() && !HasEnergySettings()) + if (!HasBattery() && !HasAutoPowerOff()) { return; } @@ -369,10 +374,18 @@ namespace GHelper.Peripherals.Mouse } } - if (HasEnergySettings()) + if (HasAutoPowerOff()) { PowerOffSetting = ParsePowerOffSetting(response); + } + + if (HasLowBatteryWarning()) + { LowBatteryWarning = ParseLowBatteryWarning(response); + } + + if (HasLowBatteryWarning() || HasAutoPowerOff()) + { Logger.WriteLine(GetDisplayName() + ": Got Auto Power Off: " + PowerOffSetting + " - Low Battery Warnning at: " + LowBatteryWarning + "%"); } @@ -467,6 +480,10 @@ namespace GHelper.Peripherals.Mouse { return false; } + public virtual bool HasAngleTuning() + { + return false; + } public virtual string PollingRateDisplayString(PollingRate pollingRate) { @@ -567,7 +584,9 @@ namespace GHelper.Peripherals.Mouse if (HasAngleSnapping()) { AngleSnapping = ParseAngleSnapping(response); - AngleAdjustmentDegrees = ParseAngleAdjustment(response); + if (HasAngleTuning()) + AngleAdjustmentDegrees = ParseAngleAdjustment(response); + Logger.WriteLine(GetDisplayName() + ": Angle Snapping enabled: " + AngleSnapping + ", Angle Adjustment: " + AngleAdjustmentDegrees + "°"); } } @@ -608,7 +627,7 @@ namespace GHelper.Peripherals.Mouse public void SetAngleAdjustment(short angleAdjustment) { - if (!HasAngleSnapping()) + if (!HasAngleTuning()) { return; } @@ -632,7 +651,7 @@ namespace GHelper.Peripherals.Mouse public abstract int DPIProfileCount(); public virtual bool HasDPIColors() { - return true; + return false; } public virtual bool CanChangeDPIProfile() diff --git a/app/Peripherals/Mouse/Models/ChakramX.cs b/app/Peripherals/Mouse/Models/ChakramX.cs index 7a96116c..f4ecde35 100644 --- a/app/Peripherals/Mouse/Models/ChakramX.cs +++ b/app/Peripherals/Mouse/Models/ChakramX.cs @@ -55,11 +55,25 @@ namespace GHelper.Peripherals.Mouse.Models return true; } - public override bool HasEnergySettings() + public override bool HasAutoPowerOff() { return true; } + public override bool HasAngleTuning() + { + return true; + } + + public override bool HasLowBatteryWarning() + { + return true; + } + + public override bool HasDPIColors() + { + return true; + } } public class ChakramXWired : ChakramX diff --git a/app/Peripherals/Mouse/Models/P711.cs b/app/Peripherals/Mouse/Models/GladiusIII.cs similarity index 65% rename from app/Peripherals/Mouse/Models/P711.cs rename to app/Peripherals/Mouse/Models/GladiusIII.cs index adadae84..3459b457 100644 --- a/app/Peripherals/Mouse/Models/P711.cs +++ b/app/Peripherals/Mouse/Models/GladiusIII.cs @@ -1,12 +1,12 @@ namespace GHelper.Peripherals.Mouse.Models { - public class P711 : AsusMouse + public class GladiusIII : AsusMouse { - public P711() : base(0x0B05, 0x1A70, "mi_00", true) + public GladiusIII() : base(0x0B05, 0x1A70, "mi_00", true) { } - protected P711(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_00", wireless) + protected GladiusIII(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_00", wireless) { } @@ -50,7 +50,7 @@ return true; } - public override bool HasEnergySettings() + public override bool HasAutoPowerOff() { return true; } @@ -59,11 +59,26 @@ { return true; } + + public override bool HasAngleTuning() + { + return true; + } + + public override bool HasLowBatteryWarning() + { + return true; + } + + public override bool HasDPIColors() + { + return true; + } } - public class P711Wired : P711 + public class GladiusIIIWired : GladiusIII { - public P711Wired() : base(0x1A72, false) + public GladiusIIIWired() : base(0x1A72, false) { } diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 69dc658c..831c4f29 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -138,8 +138,8 @@ namespace GHelper.Peripherals //Add one line for every supported mouse class here to support them. DetectMouse(new ChakramX()); DetectMouse(new ChakramXWired()); - DetectMouse(new P711()); - DetectMouse(new P711Wired()); + DetectMouse(new GladiusIII()); + DetectMouse(new GladiusIIIWired()); } public static void DetectMouse(AsusMouse am) From 7cdb95f7a4c17aaeea4487183ddbd97a7642b9d6 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Tue, 25 Jul 2023 17:25:31 +0200 Subject: [PATCH 34/34] Remove unnecessary imports --- app/AsusMouseSettings.cs | 1 - app/Peripherals/PeripheralsProvider.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/app/AsusMouseSettings.cs b/app/AsusMouseSettings.cs index 93e44ee4..e7a2d651 100644 --- a/app/AsusMouseSettings.cs +++ b/app/AsusMouseSettings.cs @@ -1,6 +1,5 @@ using GHelper.Peripherals.Mouse; using GHelper.UI; -using System.Windows.Forms; namespace GHelper { diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 831c4f29..702c2631 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -1,7 +1,6 @@ using GHelper.Peripherals.Mouse; using GHelper.Peripherals.Mouse.Models; using System.Runtime.CompilerServices; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace GHelper.Peripherals {