diff options
| author | a1xd <[email protected]> | 2020-12-02 05:25:19 -0500 |
|---|---|---|
| committer | a1xd <[email protected]> | 2020-12-02 05:25:19 -0500 |
| commit | 7d14daf1d5fce4d09471a3abe2aca49cf7680816 (patch) | |
| tree | 43411443aadc79d36ad1da8063208cd51fdb15fe /grapher/Form1.cs | |
| parent | merge common-install with common (diff) | |
| download | rawaccel-7d14daf1d5fce4d09471a3abe2aca49cf7680816.tar.xz rawaccel-7d14daf1d5fce4d09471a3abe2aca49cf7680816.zip | |
embed version info into assemblies
check app versions against lib, lib against driver
add an 'about' dialog which displays version details, accessible from menu
refactor error handling + add check for negative offset
Diffstat (limited to 'grapher/Form1.cs')
| -rw-r--r-- | grapher/Form1.cs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/grapher/Form1.cs b/grapher/Form1.cs index d62ed6d..0c12b86 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -13,6 +13,8 @@ using grapher.Models.Calculations; using grapher.Models.Options; using grapher.Models.Serialized; using grapher.Models; +using System.Reflection; +using System.Diagnostics; namespace grapher { @@ -26,21 +28,30 @@ namespace grapher { InitializeComponent(); - ManagedAccel activeAccel = null; + Version assemVersion = typeof(RawAcceleration).Assembly.GetName().Version; + Version driverVersion = null; try { - activeAccel = ManagedAccel.GetActiveAccel(); + driverVersion = VersionHelper.ValidateAndGetDriverVersion(assemVersion); } - catch (DriverNotInstalledException ex) + catch (VersionException ex) { - MessageBox.Show($"Driver not installed.\n\n {ex.ToString()}"); + MessageBox.Show(ex.Message); throw; } + + ToolStripMenuItem HelpMenuItem = new ToolStripMenuItem("&Help"); + + HelpMenuItem.DropDownItems.AddRange(new ToolStripItem[] { + new ToolStripMenuItem("&About", null, (s, e) => new AboutBox(driverVersion).ShowDialog()) + }); + + menuStrip1.Items.AddRange(new ToolStripItem[] { HelpMenuItem }); AccelGUI = AccelGUIFactory.Construct( this, - activeAccel, + ManagedAccel.GetActiveAccel(), AccelerationChart, AccelerationChartY, VelocityChart, |