private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { int vibranceIngameLevel = VibranceProxy.NVAPI_MAX_LEVEL, vibranceWindowsLevel = VibranceProxy.NVAPI_DEFAULT_LEVEL, refreshRate = 5000; bool keepActive = false, multipleMonitors = false; this.Invoke((MethodInvoker)delegate { readVibranceSettings(out vibranceIngameLevel, out vibranceWindowsLevel, out keepActive, out refreshRate, out multipleMonitors); }); v = new VibranceProxy(multipleMonitors); if (v.vibranceInfo.isInitialized) { backgroundWorker.ReportProgress(1); setGuiEnabledFlag(true); v.setShouldRun(true); v.setKeepActive(keepActive); v.setVibranceIngameLevel(vibranceIngameLevel); v.setVibranceWindowsLevel(vibranceWindowsLevel); v.setSleepInterval(refreshRate); v.handleDVC(); bool unload = v.unloadLibraryEx(); backgroundWorker.ReportProgress(2, unload); resetEvent.Set(); Application.DoEvents(); } }
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { int vibranceIngameLevel = VibranceProxy.NVAPI_MAX_LEVEL, vibranceWindowsLevel = VibranceProxy.NVAPI_DEFAULT_LEVEL, refreshRate = 5000; bool keepActive = false; this.Invoke((MethodInvoker) delegate { readVibranceSettings(out vibranceIngameLevel, out vibranceWindowsLevel, out keepActive, out refreshRate); }); v = new VibranceProxy(silenced); if (v.vibranceInfo.isInitialized) { backgroundWorker.ReportProgress(1); setGuiEnabledFlag(true); v.setShouldRun(true); v.setKeepActive(keepActive); v.setVibranceIngameLevel(vibranceIngameLevel); v.setVibranceWindowsLevel(vibranceWindowsLevel); v.setSleepInterval(refreshRate); v.handleDVC(); bool unload = v.unloadLibraryEx(); backgroundWorker.ReportProgress(2, unload); resetEvent.Set(); Application.DoEvents(); } }