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(); } }
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 cleanUp() { this.statusLabel.Text = "Closing..."; this.statusLabel.ForeColor = Color.Red; this.Update(); listBoxLog.Items.Add("Initiating observer thread exit... "); if (v != null && v.vibranceInfo.isInitialized) { v.setShouldRun(false); resetEvent.WaitOne(); listBoxLog.Items.Add("Unloading NVAPI... "); } }