public AccelCharts( RawAcceleration form, ChartXY sensitivityChart, ChartXY velocityChart, ChartXY gainChart, ToolStripMenuItem enableVelocityAndGain, ToolStripMenuItem enableLastMouseMove, Button writeButton, AccelCalculator accelCalculator) { var estimated = new EstimatedPoints(); var estimatedX = new EstimatedPoints(); var estimatedY = new EstimatedPoints(); SetupCharts(sensitivityChart, velocityChart, gainChart, estimated, estimatedX, estimatedY); var accelData = new AccelData(estimated, estimatedX, estimatedY); ChartStateManager = new ChartStateManager(sensitivityChart, velocityChart, gainChart, accelData, accelCalculator); ContainingForm = form; EnableVelocityAndGain = enableVelocityAndGain; EnableLastValue = enableLastMouseMove; WriteButton = writeButton; EnableVelocityAndGain.Click += new System.EventHandler(OnEnableClick); EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableVelocityGainCheckStateChange); EnableLastValue.CheckedChanged += new System.EventHandler(OnEnableLastMouseMoveCheckStateChange); ChartState = ChartStateManager.InitialState(); ChartState.Activate(); HideVelocityAndGain(); }
public AccelGUI( RawAcceleration accelForm, AccelCalculator accelCalculator, AccelCharts accelCharts, SettingsManager settings, ApplyOptions applyOptions, Button writeButton, ButtonBase toggleButton, MouseWatcher mouseWatcher, ToolStripMenuItem scaleMenuItem) { AccelForm = accelForm; AccelCalculator = accelCalculator; AccelCharts = accelCharts; ApplyOptions = applyOptions; WriteButton = writeButton; ToggleButton = (CheckBox)toggleButton; ScaleMenuItem = scaleMenuItem; Settings = settings; DefaultButtonFont = WriteButton.Font; SmallButtonFont = new Font(WriteButton.Font.Name, WriteButton.Font.Size * Constants.SmallButtonSizeFactor); MouseWatcher = mouseWatcher; ScaleMenuItem.Click += new System.EventHandler(OnScaleMenuItemClick); WriteButton.Click += new System.EventHandler(OnWriteButtonClick); ToggleButton.Click += new System.EventHandler(OnToggleButtonClick); AccelForm.FormClosing += new FormClosingEventHandler(SaveGUISettingsOnClose); ButtonTimerInterval = Convert.ToInt32(DriverInterop.WriteDelayMs); ButtonTimer = new Timer(); ButtonTimer.Tick += new System.EventHandler(OnButtonTimerTick); ChartRefresh = SetupChartTimer(); bool settingsActive = Settings.Startup(); SettingsNotDefault = !Settings.RawAccelSettings.IsDefaultEquivalent(); if (settingsActive) { LastToggleChecked = SettingsNotDefault; ToggleButton.Enabled = LastToggleChecked; RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings); } else { DriverSettings active = DriverInterop.GetActiveSettings(); bool activeNotDefault = !RawAccelSettings.IsDefaultEquivalent(active); LastToggleChecked = activeNotDefault; ToggleButton.Enabled = SettingsNotDefault || activeNotDefault; RefreshOnRead(active); } SetupButtons(); AccelForm.DoResize(); }