Ejemplo n.º 1
0
        public void UpdateActiveSettingsFromFields()
        {
            var driverSettings = Settings.RawAccelSettings.AccelerationSettings;

            var settings = new DriverSettings
            {
                rotation    = ApplyOptions.Rotation.Field.Data,
                sensitivity = new Vec2 <double>
                {
                    x = ApplyOptions.Sensitivity.Fields.X,
                    y = ApplyOptions.Sensitivity.Fields.Y
                },
                combineMagnitudes = ApplyOptions.IsWhole,
                modes             = ApplyOptions.GetModes(),
                args        = ApplyOptions.GetArgs(),
                minimumTime = driverSettings.minimumTime
            };

            WriteButtonDelay();
            SettingsErrors errors = Settings.TryUpdateActiveSettings(settings);

            if (errors.Empty())
            {
                RefreshToggleStateFromNewSettings();
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                throw new Exception($"Bad arguments: \n {SettingsManager.ErrorStringFrom(errors)}");
            }
        }
Ejemplo n.º 2
0
        public void UpdateActiveSettingsFromFields()
        {
            var driverSettings = Settings.RawAccelSettings.AccelerationSettings;

            var newArgs = ApplyOptions.GetArgs();

            newArgs.x.speedCap = driverSettings.args.x.speedCap;
            newArgs.y.speedCap = driverSettings.args.y.speedCap;

            var settings = new DriverSettings
            {
                rotation    = ApplyOptions.Rotation.Field.Data,
                snap        = driverSettings.snap,
                sensitivity = new Vec2 <double>
                {
                    x = ApplyOptions.Sensitivity.Fields.X,
                    y = ApplyOptions.Sensitivity.Fields.Y
                },
                combineMagnitudes = ApplyOptions.IsWhole,
                modes             = ApplyOptions.GetModes(),
                args                   = newArgs,
                minimumTime            = driverSettings.minimumTime,
                directionalMultipliers = driverSettings.directionalMultipliers,
                domainArgs             = ApplyOptions.Directionality.GetDomainArgs(),
                rangeXY                = ApplyOptions.Directionality.GetRangeXY(),
                deviceID               = DeviceIDManager.ID,
            };

            ButtonDelay(WriteButton);
            SettingsErrors errors = Settings.TryUpdateActiveSettings(settings);

            if (errors.Empty())
            {
                SettingsNotDefault = !Settings.RawAccelSettings.IsDefaultEquivalent();
                LastToggleChecked  = SettingsNotDefault;
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                new MessageDialog(errors.ToString(), "bad input").ShowDialog();
            }
        }
Ejemplo n.º 3
0
        public void UpdateActiveSettingsFromFields()
        {
            var driverSettings = Settings.RawAccelSettings.AccelerationSettings;

            var newArgs = ApplyOptions.GetArgs();

            newArgs.x.speedCap = driverSettings.args.x.speedCap;
            newArgs.y.speedCap = driverSettings.args.y.speedCap;

            var settings = new DriverSettings
            {
                rotation    = ApplyOptions.Rotation.Field.Data,
                sensitivity = new Vec2 <double>
                {
                    x = ApplyOptions.Sensitivity.Fields.X,
                    y = ApplyOptions.Sensitivity.Fields.Y
                },
                combineMagnitudes = ApplyOptions.IsWhole,
                modes             = ApplyOptions.GetModes(),
                args                   = newArgs,
                minimumTime            = driverSettings.minimumTime,
                directionalMultipliers = driverSettings.directionalMultipliers
            };

            ButtonDelay(WriteButton);
            SettingsErrors errors = Settings.TryUpdateActiveSettings(settings);

            if (errors.Empty())
            {
                SettingsNotDefault = !Settings.RawAccelSettings.IsDefaultEquivalent();
                LastToggleChecked  = SettingsNotDefault;
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                throw new Exception($"Bad arguments:\n\n{errors}");
            }
        }