Ejemplo n.º 1
0
        private void OnSourceInitialized(object sender, EventArgs e)
        {
            _complete = new Throttle(TimeSpan.FromMilliseconds(100), Complete);

            _source = (HwndSource)PresentationSource.FromVisual(_window);
            _source.AddHook(WndProc);

            TouchpadHelper.RegisterInput(_source.Handle);
        }
Ejemplo n.º 2
0
        private void OnClosed(object sender, EventArgs e)
        {
            ManipulationDelta     = null;
            ManipulationCompleted = null;

            _source?.RemoveHook(WndProc);

            TouchpadHelper.UnregisterInput();
        }
Ejemplo n.º 3
0
        public TouchpadTracker(Window window)
        {
            if (!TouchpadHelper.Exists())
            {
                return;
            }

            this._window = window ?? throw new ArgumentNullException(nameof(window));
            this._window.SourceInitialized += OnSourceInitialized;
            this._window.Closed            += OnClosed;
        }
Ejemplo n.º 4
0
 private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
 {
     switch (msg)
     {
     case TouchpadHelper.WM_INPUT:
         var contacts = TouchpadHelper.ParseInput(lParam);
         if (contacts?.Length > 1)
         {
             Check(contacts[0]);
             handled = true;
         }
         break;
     }
     return(IntPtr.Zero);
 }