public void LoadFromConfig(MainWindow mainWindow) { // Auto mainWindow.AutoCheckBox.IsChecked = config.GetBool(ConfigKeyAutoAdjust, false); // Monitors /* Disabled. Loading previous settings is useless * Most likely, user will relaunch the app with different lightning condition at different time, * so don't load Brightness/Contrast/Temperature settings from Config. * User will adjust settings manually */ foreach (MonitorManager manager in MainWindow.MonitorManagers) { LoadMonitorSettingsInto(manager, manager.MasterMonitor); foreach (Monitor monitor in manager.GetMonitorsList()) { LoadMonitorSettingsInto(manager, monitor); } } ConfigurationControl settingsWindow = mainWindow.ConfigurationControl; // Monitor managers MonitorManager monitorManager = GetMonitorManager(); MonitorManager = monitorManager; if (monitorManager.GetType().Name == hardwareMonitorMgrName) { mainWindow.MonitorManagerTabControl.SelectedItem = mainWindow.MonitorManagerTabItemHardware; } if (monitorManager.GetType().Name == gammarampMonitorMgrName) { mainWindow.MonitorManagerTabControl.SelectedItem = mainWindow.MonitorManagerTabItemGammaRamp; } if (monitorManager.GetType().Name == wmiMonitorMgrName) { mainWindow.MonitorManagerTabControl.SelectedItem = mainWindow.MonitorManagerTabItemWmi; } if (monitorManager.GetType().Name == softwareMonitorMgrName) { mainWindow.MonitorManagerTabControl.SelectedItem = mainWindow.MonitorManagerTabItemSoftware; } // Data feed settingsWindow.ThingSpeakAddressTextBox.Text = config.GetContent(ConfigKeyThingspeakAddress, ConfigKeyThingspeakAddressDefault); settingsWindow.ThingSpeakChannelTextBox.Text = config.GetContent(ConfigKeyThingspeakChannel, ConfigKeyThingspeakChannelDefault); settingsWindow.PlotFunction.Text = config.GetContent(ConfigKeyThingspeakLightFunction, ConfigKeyThingspeakLightFunctionDefault); // Start with Windows RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", false); settingsWindow.StartWithWindowsCheckbox.IsChecked = registryKey != null && registryKey.GetValue("SlimShady") != null; }
private void AddMonitorManager(TabItem tab, MonitorManager manager) { Trace(""); Trace("Adding monitor Manager: " + manager.GetType().Name); StackPanel tabContent = new StackPanel() { Orientation = Orientation.Vertical }; tab.Content = tabContent; MonitorSliders masterSlider = new MonitorSliders(manager.MasterMonitor); tabContent.Children.Add(masterSlider); int supportBrightness = 0; int supportContrast = 0; int supportTemperature = 0; List <Monitor> monitors = manager.GetMonitorsList(); foreach (Monitor monitor in monitors) { Trace("- " + monitor.ToStringDbg()); MonitorSliders slider = new MonitorSliders(monitor); tabContent.Children.Add(slider); if (monitor.SupportsBrightness) { supportBrightness++; } if (monitor.SupportsContrast) { supportContrast++; } if (monitor.SupportsTemperature) { supportTemperature++; } } // "< 2" or "== 0" whichever works better if (supportBrightness == 0) { masterSlider.BrightnessSliderLabel.Visibility = Visibility.Collapsed; masterSlider.BrightnessSlider.Visibility = Visibility.Collapsed; masterSlider.BrightnessSliderText.Visibility = Visibility.Collapsed; } if (supportContrast == 0) { masterSlider.ContrastSliderLabel.Visibility = Visibility.Collapsed; masterSlider.ContrastSlider.Visibility = Visibility.Collapsed; masterSlider.ContrastSliderText.Visibility = Visibility.Collapsed; } if (supportTemperature == 0) { masterSlider.TemperatureSliderLabel.Visibility = Visibility.Collapsed; masterSlider.TemperatureSlider.Visibility = Visibility.Collapsed; masterSlider.TemperatureSliderText.Visibility = Visibility.Collapsed; } }
private String GetConfigPrefix(MonitorManager monitorManager, Monitor monitor) { return(monitorManager.GetType().Name + "." + monitor.Name + "."); }
private void SetMonitorManager(MonitorManager manager) { MonitorManager = manager; config.Set(ConfigKeyMonitorManager, manager.GetType().Name); }