示例#1
0
 public void UpdateGraph(DriverSettings args)
 {
     AccelCharts.Calculate(
         Settings.ActiveAccel,
         args);
     AccelCharts.Bind();
 }
示例#2
0
        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();
        }
示例#3
0
 private void OnChartTimerTick(object sender, EventArgs e)
 {
     AccelCharts.DrawLastMovement();
     MouseWatcher.UpdateLastMove();
 }
示例#4
0
 public void UpdateShownActiveValues(DriverSettings args)
 {
     AccelForm.ResetAutoScroll();
     AccelCharts.ShowActive(args);
     ApplyOptions.SetActiveValues(args);
 }