private void UpdateProcessToCaptureList() { var selectedProcessToCapture = SelectedProcessToCapture; var backupProcessList = new List <string>(ProcessesToCapture); ProcessesToCapture.Clear(); var filter = CaptureServiceConfiguration.GetProcessIgnoreList(); var processList = _captureService.GetAllFilteredProcesses(filter).Distinct(); ProcessesToCapture.AddRange(processList); // fire update global hook if new process is detected if (backupProcessList.Count != ProcessesToCapture.Count) { UpdateGlobalHookEvent(); } if (!processList.Contains(selectedProcessToCapture)) { SelectedProcessToCapture = null; } else { SelectedProcessToCapture = selectedProcessToCapture; } Application.Current.Dispatcher.Invoke(new Action(() => { UpdateCaptureStateInfo(); })); }
private void UpdateProcessToCaptureList() { var selectedProcessToCapture = SelectedProcessToCapture; var backupProcessList = new List <string>(ProcessesToCapture); ProcessesToCapture.Clear(); var filter = CaptureServiceConfiguration.GetProcessIgnoreList(); var processList = _captureService.GetAllFilteredProcesses(filter).Distinct(); ProcessesToCapture.AddRange(processList); if (ProcessesToCapture.Any() && !string.IsNullOrWhiteSpace(_lastCapturedProcess)) { if (!ProcessesToCapture.Contains(_lastCapturedProcess) || (selectedProcessToCapture != null && selectedProcessToCapture != _lastCapturedProcess)) { _overlayService.ResetHistory(); } } // fire update global hook if new process is detected if (backupProcessList.Count != ProcessesToCapture.Count) { UpdateGlobalCaptureHookEvent(); } if (!processList.Contains(selectedProcessToCapture)) { SelectedProcessToCapture = null; } else { SelectedProcessToCapture = selectedProcessToCapture; } Application.Current.Dispatcher.Invoke(new Action(() => { UpdateCaptureStateInfo(); })); }