예제 #1
0
 private static void OnPreProcessInput(object sender, PreProcessInputEventArgs e)
 {
     if (e.StagingItem.Input.Device != null)
     {
         e.Cancel();
     }
 }
예제 #2
0
        private void InputDeviceEvents_PreProcessInput(object sender, PreProcessInputEventArgs e)
        {
            if (e.StagingItem.Input.Device is TouchDevice)
            {
                InputReportEventArgs irea = e.StagingItem.Input as InputReportEventArgs;
                if (irea != null)
                {
                    RawTouchInputReport rtir = irea.Report as RawTouchInputReport;
                    if (rtir != null)
                    {
                        // cancel any touch event that does not start within the modal window
                        //if (!this.ContainsPoint(rtir.Touches[0].X, rtir.Touches[0].Y))
                        //    e.Cancel();

                        int x = rtir.Touches[0].X;
                        int y = rtir.Touches[0].Y;
                        PointToClient(ref x, ref y);
                        if (!Utils.IsWithinRectangle(x, y, ActualWidth, ActualWidth))
                        {
                            e.Cancel();
                        }
                    }
                }
            }
        }
예제 #3
0
        void inputManager_PreProcessInput(object sender, PreProcessInputEventArgs e)
        {
            RoutedEvent routedEvent = e.StagingItem.Input.RoutedEvent;

            if (routedEvent == PreviewRawInputEvent)
            {
                RawMultitouchReport report = e.StagingItem.Input as RawMultitouchReport;
                if (report != null && !report.Handled)
                {
                    switch (report.Context.Contact.State)
                    {
                    case ContactState.New:
                        return;

                    case ContactState.Removed:
                    case ContactState.Moved:
                    {
                        Contact contact;
                        if (!ContactsManager.ExistingContacts.TryGetValue(report.Context.Contact.Id, out contact))
                        {
                            break;
                        }
                        report.UpdateFromPrevious(contact.InputArgs);
                        return;
                    }

                    default:
                        return;
                    }
                    report.Handled = true;
                }
            }
            else if (!MultitouchScreen.AllowNonContactEvents)
            {
                if (!IsContactEvent(routedEvent))
                {
                    e.StagingItem.Input.Handled = true;
                    e.Cancel();
                }
            }
            Debug.Assert(routedEvent != null, "routed event null");
        }
예제 #4
0
        private void Current_PreProcessInput(object sender, PreProcessInputEventArgs e)
        {
            RoutedEvent routedEvent = e.StagingItem.Input.RoutedEvent;

            if (routedEvent == Keyboard.PreviewKeyDownEvent)
            {
                KeyEventArgs keyArgs = (KeyEventArgs)e.StagingItem.Input;
                if (keyArgs.Key == Key.Escape)
                {
                    _owner.IsOpen = false;
                    e.Cancel();
                }
            }

            //RoutedEvent routedEvent = e.StagingItem.Input.RoutedEvent;

            //if (routedEvent == Keyboard.PreviewKeyDownEvent)
            //{
            //	KeyEventArgs keyArgs = (KeyEventArgs)e.StagingItem.Input;

            //	if (keyArgs.Key == Key.Up || keyArgs.Key == Key.Down)
            //	{
            //		// Creating a FocusNavigationDirection object and setting it to a
            //		// local field that contains the direction selected.
            //		FocusNavigationDirection focusDirection = keyArgs.Key == Key.Up ? FocusNavigationDirection.Up : FocusNavigationDirection.Down;

            //		// MoveFocus takes a TraveralReqest as its argument.
            //		TraversalRequest request = new TraversalRequest(focusDirection);

            //		// Gets the element with keyboard focus.
            //		UIElement elementWithFocus = Keyboard.FocusedElement as UIElement;

            //		// Change keyboard focus.
            //		if (elementWithFocus != null)
            //		{
            //			elementWithFocus.MoveFocus(request);
            //			e.StagingItem.Input.Handled = true;
            //		}
            //	}
            //}
        }
예제 #5
0
 private void InputDeviceEvents_PreProcessInput(object sender, PreProcessInputEventArgs e)
 {
     if (e.StagingItem.Input.Device is TouchDevice)
     {
         InputReportEventArgs irea = e.StagingItem.Input as InputReportEventArgs;
         if (irea != null)
         {
             RawTouchInputReport rtir = irea.Report as RawTouchInputReport;
             if (rtir != null)
             {
                 int x = rtir.Touches[0].X;
                 int y = rtir.Touches[0].Y;
                 PointToClient(ref x, ref y);
                 if (!Utils.IsWithinRectangle(x, y, ActualWidth, ActualWidth))
                 {
                     e.Cancel();
                 }
             }
         }
     }
 }