Exemple #1
0
        private void OnFocusedWindowTitleChanged(object sender, FocusedWindowTitleChangedEventArgs e)
        {
            if (_currentFullCaptureWindowInfo != null && //Full capture window focus is only lost if we ever had it in focus
                (
                    _currentActiveFullCaptureAction.AutoCaptureSubWindows && e.NewFocusedWindow.ProcessId != e.OldFocusedWindow.ProcessId || //If new focused window is no parent of old focused window
                    !_currentActiveFullCaptureAction.AutoCaptureSubWindows && e.NewFocusedWindow.Title != _currentFullCaptureWindowInfo.Title //If new window title is not old window title
                ))
            {
                OnFullCapturedWindowFocusLost();
                return;
            }

            //Abort "on focused" when we already are full capturing and the new focused window is our current full capture window
            if (_currentFullCaptureWindowInfo != null && _currentFullCaptureWindowInfo.Title == e.NewFocusedWindow.Title)
            {
                return;
            }

            foreach (CaptureFullWindowAction action in _captureFullWindowActionRepository.GetAll())
            {
                if (e.NewFocusedWindow.Title != string.Empty &&
                    _windowMatchService.DoesTitleMatch(e.NewFocusedWindow.Title, action.CaptureWindowTitle))
                {
                    OnFullCaptureWindowFocused(action, e.NewFocusedWindow);
                    break;
                }
            }
        }
Exemple #2
0
 private void OnFocusedWindowTitleChanged(object sender, FocusedWindowTitleChangedEventArgs e)
 {
     if (_settingsRepository.Get().DebugMode)
     {
         _logger.Write(LogLevel.Debug, $"[FocusedWindowChange][Old] {e.OldFocusedWindow?.Title} [{e.OldFocusedWindow?.ProcessId}] [{e.OldFocusedWindow?.ThreadId}]");
         _logger.Write(LogLevel.Debug, $"[FocusedWindowChange][New] {e.NewFocusedWindow?.Title} [{e.NewFocusedWindow?.ProcessId}] [{e.NewFocusedWindow?.ThreadId}]");
     }
 }
        private void OnFocusedWindowTitleChanged(object sender, FocusedWindowTitleChangedEventArgs e)
        {
            if (_currentFocusedWindowInfo != null && //Full capture window focus is only lost if we ever had it in focus
                (
                    _currentFocusAction.IncludeSubWindows && e.NewFocusedWindow.ProcessId != e.OldFocusedWindow.ProcessId || //If new focused window is no parent of old focused window
                    !_currentFocusAction.IncludeSubWindows && e.NewFocusedWindow.Title != _currentFocusedWindowInfo.Title    //If new window title is not old window title
                ))
            {
                OnActionWindowFocusLost(e.NewFocusedWindow);
            }

            FocusedWindowSourceVisibilityAction foundChangeAction = _sourceVisibilityActionRepository.GetAll()
                                                                    .FirstOrDefault(a => _windowMatchService.DoesTitleMatch(e.NewFocusedWindow.Title, a.WindowTitle));

            if (foundChangeAction == null)
            {
                return;
            }

            OnActionWindowFocused(foundChangeAction, e.NewFocusedWindow);
        }