diff options
| author | Jacob Palecki <[email protected]> | 2020-08-22 02:46:45 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-22 02:46:45 -0700 |
| commit | b874058d82a60a39163e91a26f370ff308b8af32 (patch) | |
| tree | 7e14357f1e1e2b2b9726c72ae7b679fd5b475af2 /grapher/Models/Serialized/GUISettings.cs | |
| parent | Serialization mostly working (diff) | |
| download | rawaccel-b874058d82a60a39163e91a26f370ff308b8af32.tar.xz rawaccel-b874058d82a60a39163e91a26f370ff308b8af32.zip | |
Saving and loading fully works
Diffstat (limited to 'grapher/Models/Serialized/GUISettings.cs')
| -rw-r--r-- | grapher/Models/Serialized/GUISettings.cs | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/grapher/Models/Serialized/GUISettings.cs b/grapher/Models/Serialized/GUISettings.cs index 8c182ae..7c8e9a4 100644 --- a/grapher/Models/Serialized/GUISettings.cs +++ b/grapher/Models/Serialized/GUISettings.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -11,41 +12,22 @@ namespace grapher.Models.Serialized [Serializable] public class GUISettings { - public GUISettings( - Field dpiField, - Field pollRateField, - ToolStripMenuItem autoWriteMenuItem) + public GUISettings() {} + + public GUISettings(bool autoWrite, int dpi, int pollRate) { - BindToGUI(dpiField, pollRateField, autoWriteMenuItem); + AutoWriteToDriverOnStartup = autoWrite; + DPI = dpi; + PollRate = pollRate; } + [JsonProperty(Order = 1)] public bool AutoWriteToDriverOnStartup { get; set; } + [JsonProperty(Order = 2)] public int DPI { get; set; } + [JsonProperty(Order = 3)] public int PollRate { get; set; } - - [field: NonSerialized] - private Field DpiField { get; set; } - - [field: NonSerialized] - private Field PollRateField { get; set; } - - [field: NonSerialized] - private ToolStripMenuItem AutoWriteMenuItem { get; set; } - - public void UpdateSettings() - { - DPI = (int)DpiField.Data; - PollRate = (int)PollRateField.Data; - AutoWriteToDriverOnStartup = AutoWriteMenuItem.Checked; - } - - public void BindToGUI(Field dpiField, Field pollRateField, ToolStripMenuItem autoWriteMenuItem) - { - DpiField = dpiField; - PollRateField = pollRateField; - AutoWriteMenuItem = autoWriteMenuItem; - } } } |