Ejemplo n.º 1
0
        protected override void OnClick()
        {
            if (AdvancedModeEnabled)
            {
                // Stop forcing advanced mode on, and sync the thresholds so we exit advanced mode.
                ForcedOn = false;

                foreach (Tuple <int, SMX.SMXConfig> activePad in ActivePad.ActivePads())
                {
                    int           pad    = activePad.Item1;
                    SMX.SMXConfig config = activePad.Item2;
                    ConfigPresets.SyncUnifiedThresholds(ref config);
                    SMX.SMX.SetConfig(pad, config);
                }
                CurrentSMXDevice.singleton.FireConfigurationChanged(this);
            }
            else
            {
                // Enable advanced mode.
                ForcedOn = true;
            }

            // Refresh the UI.
            LoadUIFromConfig(ActivePad.GetFirstActivePadConfig());
        }
Ejemplo n.º 2
0
        protected override void OnClick()
        {
            if (AdvancedModeEnabled)
            {
                // Stop forcing advanced mode on, and sync the thresholds so we exit advanced mode.
                ForcedOn = false;

                for (int pad = 0; pad < 2; ++pad)
                {
                    SMX.SMXConfig config;
                    if (!SMX.SMX.GetConfig(pad, out config))
                    {
                        continue;
                    }

                    ConfigPresets.SyncUnifiedThresholds(ref config);
                    SMX.SMX.SetConfig(pad, config);
                }
                CurrentSMXDevice.singleton.FireConfigurationChanged(this);
            }
            else
            {
                // Enable advanced mode.
                ForcedOn = true;
            }

            // Refresh the UI.
            LoadFromConfigDelegateArgs args = CurrentSMXDevice.singleton.GetState();

            LoadUIFromConfig(args.controller[args.FirstController].config);
        }
Ejemplo n.º 3
0
        private void SetValueToConfig(ref SMX.SMXConfig config)
        {
            byte lower = (byte)slider.LowerValue;
            byte upper = (byte)slider.UpperValue;

            switch (Type)
            {
            case "up-left":    config.panelThreshold0Low = lower;     config.panelThreshold0High = upper; break;

            case "up":         config.panelThreshold1Low = lower;     config.panelThreshold1High = upper; break;

            case "up-right":   config.panelThreshold2Low = lower;     config.panelThreshold2High = upper; break;

            case "left":       config.panelThreshold3Low = lower;     config.panelThreshold3High = upper; break;

            case "center":     config.panelThreshold4Low = lower;     config.panelThreshold4High = upper; break;

            case "right":      config.panelThreshold5Low = lower;     config.panelThreshold5High = upper; break;

            case "down-left":  config.panelThreshold6Low = lower;     config.panelThreshold6High = upper; break;

            case "down":       config.panelThreshold7Low = lower;     config.panelThreshold7High = upper; break;

            case "down-right": config.panelThreshold8Low = lower;     config.panelThreshold8High = upper; break;

            case "cardinal":   config.panelThreshold7Low = lower;     config.panelThreshold7High = upper; break;

            case "corner":     config.panelThreshold2Low = lower;     config.panelThreshold2High = upper; break;
            }

            // If we're not in advanced mode, sync the cardinal value to each of the panel values.
            if (!AdvancedModeEnabled)
            {
                ConfigPresets.SyncUnifiedThresholds(ref config);
            }
        }