diff options
| author | Jacob Palecki <[email protected]> | 2021-01-20 00:42:24 -0800 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2021-01-20 00:42:24 -0800 |
| commit | 77b4c7876918cac82494ec8fc15a22fdab5cf714 (patch) | |
| tree | 66b2c7d86cecf0846c3b5cdaa69c6991858ed931 /grapher/Models/AccelGUI.cs | |
| parent | Remove debug statement (diff) | |
| parent | show custom dialog on bad input (#63) (diff) | |
| download | rawaccel-77b4c7876918cac82494ec8fc15a22fdab5cf714.tar.xz rawaccel-77b4c7876918cac82494ec8fc15a22fdab5cf714.zip | |
merge with master builds
Diffstat (limited to 'grapher/Models/AccelGUI.cs')
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index e125310..5f05798 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -1,4 +1,5 @@ using grapher.Models.Calculations; +using grapher.Models.Devices; using grapher.Models.Mouse; using grapher.Models.Options; using grapher.Models.Serialized; @@ -23,7 +24,8 @@ namespace grapher Button writeButton, ButtonBase toggleButton, MouseWatcher mouseWatcher, - ToolStripMenuItem scaleMenuItem) + ToolStripMenuItem scaleMenuItem, + DeviceIDManager deviceIDManager) { AccelForm = accelForm; AccelCalculator = accelCalculator; @@ -36,6 +38,7 @@ namespace grapher DefaultButtonFont = WriteButton.Font; SmallButtonFont = new Font(WriteButton.Font.Name, WriteButton.Font.Size * Constants.SmallButtonSizeFactor); MouseWatcher = mouseWatcher; + DeviceIDManager = deviceIDManager; ScaleMenuItem.Click += new System.EventHandler(OnScaleMenuItemClick); WriteButton.Click += new System.EventHandler(OnWriteButtonClick); @@ -95,6 +98,10 @@ namespace grapher public ToolStripMenuItem ScaleMenuItem { get; } + public DeviceIDManager DeviceIDManager { get; } + + public Action UpdateInputManagers { get; private set; } + private Timer ChartRefresh { get; } private Font SmallButtonFont { get; } @@ -144,6 +151,7 @@ namespace grapher directionalMultipliers = driverSettings.directionalMultipliers, domainArgs = ApplyOptions.Directionality.GetDomainArgs(), rangeXY = ApplyOptions.Directionality.GetRangeXY(), + deviceID = DeviceIDManager.ID, }; ButtonDelay(WriteButton); @@ -156,7 +164,7 @@ namespace grapher } else { - throw new Exception($"Bad arguments:\n\n{errors}"); + new MessageDialog(errors.ToString(), "bad input").ShowDialog(); } } @@ -164,6 +172,14 @@ namespace grapher { UpdateShownActiveValues(args); UpdateGraph(args); + + UpdateInputManagers = () => + { + MouseWatcher.UpdateHandles(args.deviceID); + DeviceIDManager.Update(args.deviceID); + }; + + UpdateInputManagers(); } public void UpdateGraph(DriverSettings args) |