From 2be0106211cb4ce30036fc0c8e84ae70dff68c87 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 8 Oct 2020 02:07:56 -0400 Subject: add toggle button + save gui settings on close remove option to disable write on startup --- grapher/Models/Serialized/GUISettings.cs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'grapher/Models/Serialized/GUISettings.cs') diff --git a/grapher/Models/Serialized/GUISettings.cs b/grapher/Models/Serialized/GUISettings.cs index 84e681b..f9e5755 100644 --- a/grapher/Models/Serialized/GUISettings.cs +++ b/grapher/Models/Serialized/GUISettings.cs @@ -10,32 +10,35 @@ namespace grapher.Models.Serialized public GUISettings() {} - public GUISettings(bool autoWrite, int dpi, int pollRate) - { - AutoWriteToDriverOnStartup = autoWrite; - DPI = dpi; - PollRate = pollRate; - } - #endregion Constructors #region Properties - [JsonProperty(Order = 1)] - public bool AutoWriteToDriverOnStartup { get; set; } - [JsonProperty(Order = 2)] + [JsonProperty(Order = 1)] public int DPI { get; set; } - [JsonProperty(Order = 3)] + [JsonProperty(Order = 2)] public int PollRate { get; set; } - [JsonProperty(Order = 4)] + [JsonProperty(Order = 3)] public bool ShowLastMouseMove { get; set; } [JsonProperty(Order = 4)] public bool ShowVelocityAndGain { get; set; } #endregion Properties + + #region Methods + + public bool ValueEquals(GUISettings other) + { + return DPI == other.DPI && + PollRate == other.PollRate && + ShowLastMouseMove == other.ShowLastMouseMove && + ShowVelocityAndGain == other.ShowVelocityAndGain; + } + + #endregion Methods } } -- cgit v1.2.3 From 0039d6e84d4e05e842542ad021a9c21e619c69c2 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 8 Oct 2020 19:44:40 -0700 Subject: Follow full C# convention --- grapher/Models/Serialized/GUISettings.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'grapher/Models/Serialized/GUISettings.cs') diff --git a/grapher/Models/Serialized/GUISettings.cs b/grapher/Models/Serialized/GUISettings.cs index f9e5755..c8f87ae 100644 --- a/grapher/Models/Serialized/GUISettings.cs +++ b/grapher/Models/Serialized/GUISettings.cs @@ -31,7 +31,19 @@ namespace grapher.Models.Serialized #region Methods - public bool ValueEquals(GUISettings other) + public override bool Equals(object obj) + { + var other = obj as GUISettings; + + if (other == null) + { + return false; + } + + return Equals(other); + } + + public bool Equals(GUISettings other) { return DPI == other.DPI && PollRate == other.PollRate && @@ -39,6 +51,14 @@ namespace grapher.Models.Serialized ShowVelocityAndGain == other.ShowVelocityAndGain; } + public override int GetHashCode() + { + return DPI.GetHashCode() ^ + PollRate.GetHashCode() ^ + ShowLastMouseMove.GetHashCode() ^ + ShowVelocityAndGain.GetHashCode(); + } + #endregion Methods } } -- cgit v1.2.3