private void SystemEventsOnDisplaySettingsChanged(object sender, EventArgs e)
        {
            if (_brushProvider.Instance == null || !_brushProvider.Instance.IsEnabled)
            {
                _logger?.Debug("Display settings changed, but ambilight feature is disabled");
            }
            else
            {
                _logger?.Debug("Display settings changed, restarting ambilight feature");

                _managementService.DisablePluginFeature(_brushProvider.Instance, false);
                ScreenCaptureService?.Dispose();
                ScreenCaptureService = new AmbilightScreenCaptureService(new DX11ScreenCaptureService());
                _managementService.EnablePluginFeature(_brushProvider.Instance, false);
            }
        }
Example #2
0
        protected override void OnClose()
        {
            _ledenetDeviceDefinitionsSetting.Value.Clear();
            _ledenetDeviceDefinitionsSetting.Value.AddRange(Definitions.Where(d => !string.IsNullOrWhiteSpace(d.HostName)));
            _ledenetDeviceDefinitionsSetting.Save();

            Task.Run(() =>
            {
                LedenetDeviceProvider deviceProvider = Plugin.GetFeature <LedenetDeviceProvider>();
                if (deviceProvider == null || !deviceProvider.IsEnabled)
                {
                    return;
                }
                _pluginManagementService.DisablePluginFeature(deviceProvider, false);
                _pluginManagementService.EnablePluginFeature(deviceProvider, false);
            });
            base.OnClose();
        }