diff options
| author | Jacob Palecki <[email protected]> | 2020-09-27 21:13:03 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-27 21:13:03 -0700 |
| commit | 5d8700a462b4798c02f4a73bc66d2a69a4920ae1 (patch) | |
| tree | 3a2b71991a6efce65be9af0c303ec2b59bdebff4 /grapher/Models/AccelGUI.cs | |
| parent | Set tab order (diff) | |
| parent | Merge pull request #26 from a1xd/argcheck (diff) | |
| download | rawaccel-5d8700a462b4798c02f4a73bc66d2a69a4920ae1.tar.xz rawaccel-5d8700a462b4798c02f4a73bc66d2a69a4920ae1.zip | |
Merge and fix write button
Diffstat (limited to 'grapher/Models/AccelGUI.cs')
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index 1fff4c3..c9c4ed0 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -3,6 +3,7 @@ using grapher.Models.Mouse; using grapher.Models.Options; using grapher.Models.Serialized; using System; +using System.Drawing; using System.Windows.Forms; namespace grapher @@ -72,6 +73,8 @@ namespace grapher public void UpdateActiveSettingsFromFields() { + var driverSettings = Settings.RawAccelSettings.AccelerationSettings; + var settings = new DriverSettings { rotation = ApplyOptions.Rotation.Field.Data, @@ -82,13 +85,20 @@ namespace grapher }, combineMagnitudes = ApplyOptions.IsWhole, modes = ApplyOptions.GetModes(), - args = ApplyOptions.GetArgs(), - minimumTime = .4 + args = ApplyOptions.GetUpdatedArgs(ref driverSettings.args), + minimumTime = driverSettings.minimumTime }; WriteButtonDelay(); - Settings.UpdateActiveSettings(settings); - RefreshOnRead(); + SettingsErrors errors = Settings.TryUpdateActiveSettings(settings); + if (errors.Empty()) + { + RefreshOnRead(); + } + else + { + WriteButton.Text = "bad args"; + } } public void RefreshOnRead() @@ -126,7 +136,7 @@ namespace grapher { Timer buttonTimer = new Timer(); buttonTimer.Enabled = true; - buttonTimer.Interval = Convert.ToInt32(ManagedAccel.WriteDelay); + buttonTimer.Interval = Convert.ToInt32(DriverInterop.WriteDelayMs); buttonTimer.Tick += new System.EventHandler(OnButtonTimerTick); return buttonTimer; } @@ -141,12 +151,14 @@ namespace grapher { WriteButton.Text = Constants.WriteButtonDefaultText; WriteButton.Enabled = true; + WriteButton.Update(); } private void SetWriteButtonDelay() { WriteButton.Enabled = false; WriteButton.Text = $"{Constants.WriteButtonDelayText} : {ButtonTimer.Interval} ms"; + WriteButton.Update(); } private void OnScaleMenuItemClick(object sender, EventArgs e) |