Пример #1
0
        private void RegisterHotKeys()
        {
            _hotKeyService.UnregisterAllHotKeys();

            if (_settingsService.ToggleHotKey != HotKey.None)
            {
                _hotKeyService.RegisterHotKey(_settingsService.ToggleHotKey, Toggle);
            }
        }
Пример #2
0
        private void SyncSettings()
        {
            // Register hotkeys
            _hotKeyService.UnregisterAllHotKeys();
            if (_settingsService.ToggleHotKey != HotKey.None)
            {
                _hotKeyService.RegisterHotKey(_settingsService.ToggleHotKey, Toggle);
            }

            // Set autostart
            if (_settingsService.IsAutoStartEnabled)
            {
                _registryService.EnableAutoStart();
            }
            else
            {
                _registryService.DisableAutoStart();
            }
        }
Пример #3
0
        private void RegisterHotKeys()
        {
            _hotKeyService.UnregisterAllHotKeys();

            if (_settingsService.ToggleHotKey != HotKey.None)
            {
                _hotKeyService.RegisterHotKey(_settingsService.ToggleHotKey, Toggle);
            }

            if (_settingsService.IncreaseTemperatureOffsetHotKey != HotKey.None)
            {
                _hotKeyService.RegisterHotKey(_settingsService.IncreaseTemperatureOffsetHotKey, () =>
                {
                    const double delta = +100;

                    // Avoid changing offset when it's already at its limit
                    if (TargetConfiguration.WithOffset(delta, 0) != TargetConfiguration)
                    {
                        TemperatureOffset += delta;
                    }
                });
            }

            if (_settingsService.DecreaseTemperatureOffsetHotKey != HotKey.None)
            {
                _hotKeyService.RegisterHotKey(_settingsService.DecreaseTemperatureOffsetHotKey, () =>
                {
                    const double delta = -100;

                    // Avoid changing offset when it's already at its limit
                    if (TargetConfiguration.WithOffset(delta, 0) != TargetConfiguration)
                    {
                        TemperatureOffset += delta;
                    }
                });
            }

            if (_settingsService.IncreaseBrightnessOffsetHotKey != HotKey.None)
            {
                _hotKeyService.RegisterHotKey(_settingsService.IncreaseBrightnessOffsetHotKey, () =>
                {
                    const double delta = +0.05;

                    // Avoid changing offset when it's already at its limit
                    if (TargetConfiguration.WithOffset(0, delta) != TargetConfiguration)
                    {
                        BrightnessOffset += delta;
                    }
                });
            }

            if (_settingsService.DecreaseBrightnessOffsetHotKey != HotKey.None)
            {
                _hotKeyService.RegisterHotKey(_settingsService.DecreaseBrightnessOffsetHotKey, () =>
                {
                    const double delta = -0.05;

                    // Avoid changing offset when it's already at its limit
                    if (TargetConfiguration.WithOffset(0, delta) != TargetConfiguration)
                    {
                        BrightnessOffset += delta;
                    }
                });
            }

            if (_settingsService.ResetConfigurationOffsetHotKey != HotKey.None)
            {
                _hotKeyService.RegisterHotKey(_settingsService.ResetConfigurationOffsetHotKey, ResetConfigurationOffset);
            }
        }
Пример #4
0
 protected override void OnSourceInitialized(EventArgs e)
 {
     _hotKeyService.RegisterHotKey(this, OnHotKeyAction);
     base.OnSourceInitialized(e);
 }