Esempio n. 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;
                }
            }
        }
Esempio n. 2
0
        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);
            }

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

            if (foundChangeAction == null)
            {
                return;
            }

            OnActionWindowFocused(foundChangeAction, e.NewFocusedWindow);
        }