Beispiel #1
0
        private void SetGlobalHookEventResetHistoryHotkey()
        {
            if (!CXHotkey.IsValidHotkey(ResetHistoryHotkeyString))
            {
                return;
            }

            var onCombinationDictionary = new Dictionary <CXHotkeyCombination, Action>
            {
                { CXHotkeyCombination.FromString(ResetHistoryHotkeyString), () =>
                  {
                      _overlayService.ResetHistory();
                  } }
            };

            _globalResetHistoryHookEvent = Hook.GlobalEvents();
            _globalResetHistoryHookEvent.OnCXCombination(onCombinationDictionary);
        }
Beispiel #2
0
        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();
            }));
        }