示例#1
0
        protected PointCapture()
        {
            _pointerInputTargetWindow        = new PointerInputTargetWindow();
            _inputProvider                   = new InputProvider();
            _pointEventTranslator            = new PointEventTranslator(_inputProvider);
            _pointEventTranslator.PointDown += (PointEventTranslator_PointDown);
            _pointEventTranslator.PointUp   += (PointEventTranslator_PointUp);
            _pointEventTranslator.PointMove += (PointEventTranslator_PointMove);

            _winEventDele  = WinEventProc;
            _hWinEventHook = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_MINIMIZEEND, IntPtr.Zero, _winEventDele, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);

            if (AppConfig.UiAccess)
            {
                ForegroundApplicationsChanged += PointCapture_ForegroundApplicationsChanged;
            }

            ModeChanged += (o, e) =>
            {
                if (e.Mode == CaptureMode.UserDisabled)
                {
                    _pointerInputTargetWindow.BlockTouchInputThreshold = 0;
                }
            };

            _timeoutTimer.Tick += GestureRecognizedCallback;
        }
示例#2
0
        protected PointCapture()
        {
            _pointerInputTargetWindow        = new PointerInputTargetWindow();
            _inputProvider                   = new InputProvider();
            _pointEventTranslator            = new PointEventTranslator(_inputProvider);
            _pointEventTranslator.PointDown += (PointEventTranslator_PointDown);
            _pointEventTranslator.PointUp   += (PointEventTranslator_PointUp);
            _pointEventTranslator.PointMove += (PointEventTranslator_PointMove);

            _currentContext = SynchronizationContext.Current;

            _winEventDele  = WinEventProc;
            _hWinEventHook = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_MINIMIZEEND, IntPtr.Zero, _winEventDele, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);

            if (AppConfig.UiAccess)
            {
                _blockTouchDelayTimer          = new System.Threading.Timer(UpdateBlockTouchInputThresholdCallback, null, Timeout.Infinite, Timeout.Infinite);
                ForegroundApplicationsChanged += PointCapture_ForegroundApplicationsChanged;
            }

            ModeChanged += (o, e) =>
            {
                if (e.Mode == CaptureMode.UserDisabled)
                {
                    _pointerInputTargetWindow.BlockTouchInputThreshold = 0;
                }
            };
            SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
        }