private void trackBarIngameLevel_Scroll(object sender, EventArgs e) { NvidiaSettingsWrapper setting = NvidiaSettingsWrapper.find(trackBarIngameLevel.Value); if (setting == null) { return; } v.setVibranceIngameLevel(trackBarIngameLevel.Value); labelIngameLevel.Text = setting.getPercentage; if (!settingsBackgroundWorker.IsBusy) { settingsBackgroundWorker.RunWorkerAsync(); } }
public static NvidiaSettingsWrapper find(int value) { if (settingsList == null) { settingsList = generateSettingsWrapper(); } NvidiaSettingsWrapper returnWrapper = settingsList.Find(x => x.getValue == value); //some values are not stored by nvidia internally. use the value below that. if (returnWrapper == null) { returnWrapper = find(value + 1); } return(returnWrapper); }
private void readVibranceSettings(out int vibranceIngameLevel, out int vibranceWindowsLevel, out bool keepActive, out int refreshRate) { registryController = new RegistryController(); this.checkBoxAutostart.Checked = registryController.isProgramRegistered(appName); SettingsController settingsController = new SettingsController(); settingsController.readVibranceSettings(out vibranceIngameLevel, out vibranceWindowsLevel, out keepActive, out refreshRate); //no null check needed, SettingsController will always return matching values. labelWindowsLevel.Text = NvidiaSettingsWrapper.find(vibranceWindowsLevel).getPercentage; labelIngameLevel.Text = NvidiaSettingsWrapper.find(vibranceIngameLevel).getPercentage; trackBarWindowsLevel.Value = vibranceWindowsLevel; trackBarIngameLevel.Value = vibranceIngameLevel; checkBoxKeepActive.Checked = keepActive; textBoxRefreshRate.Text = refreshRate.ToString(); }