コード例 #1
0
        private void PostProcessInput(object sender, ProcessInputEventArgs e)
        {
            InputReportEventArgs input = e.StagingItem.Input as InputReportEventArgs;
            if (input != null && input.RoutedEvent == InputManager.InputReportEvent)
            {
                RawGenericInputReport report = input.Report as RawGenericInputReport;

                if (report != null)
                {
                    if (!e.StagingItem.Input.Handled)
                    {
                        GenericEvent ge = (GenericEvent)report.InternalEvent;
                        GenericEventArgs args = new GenericEventArgs(
                            this,
                            report.InternalEvent);

                        args.RoutedEvent = GenericEvents.GenericStandardEvent;
                        if (report.Target != null)
                        {
                            args.Source = report.Target;
                        }

                        e.PushInput(args, e.StagingItem);
                    }
                }
            }
        }
コード例 #2
0
        private void PostProcessInput(object sender, ProcessInputEventArgs e)
        {
            InputReportEventArgs input = e.StagingItem.Input as InputReportEventArgs;

            if (input != null && input.RoutedEvent == InputManager.InputReportEvent)
            {
                RawGenericInputReport report = input.Report as RawGenericInputReport;

                if (report != null)
                {
                    if (!e.StagingItem.Input.Handled)
                    {
                        GenericEvent     ge   = (GenericEvent)report.InternalEvent;
                        GenericEventArgs args = new GenericEventArgs(
                            this,
                            report.InternalEvent);

                        args.RoutedEvent = GenericEvents.GenericStandardEvent;
                        if (report.Target != null)
                        {
                            args.Source = report.Target;
                        }

                        e.PushInput(args, e.StagingItem);
                    }
                }
            }
        }
コード例 #3
0
        private void PostProcessInput(object sender, ProcessInputEventArgs e)
        {
            if (!e.StagingItem.Input.Handled)
            {
                RoutedEvent routedEvent = e.StagingItem.Input.RoutedEvent;
                if (routedEvent == InputManager.InputReportEvent)
                {
                    InputReportEventArgs input = e.StagingItem.Input as InputReportEventArgs;
                    if (input != null)
                    {
                        RawTouchInputReport report = input.Report as RawTouchInputReport;
                        if (report != null)
                        {
                            TouchEventArgs args = new TouchEventArgs(
                                this,
                                report.Timestamp,
                                report.Touches);

                            UIElement target = report.Target;
                            if (report.EventMessage == (byte)TouchMessages.Down)
                            {
                                args.RoutedEvent = TouchEvents.TouchDownEvent;
                            }
                            else if (report.EventMessage == (byte)TouchMessages.Up)
                            {
                                args.RoutedEvent = TouchEvents.TouchUpEvent;
                            }
                            else if (report.EventMessage == (byte)TouchMessages.Move)
                            {
                                args.RoutedEvent = TouchEvents.TouchMoveEvent;
                            }
                            else
                            {
                                throw new Exception("Unknown touch event.");
                            }

                            args.Source = (target == null ? _focus : target);
                            e.PushInput(args, e.StagingItem);
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: TouchDevice.cs プロジェクト: adamlin1970/NetmfSTM32
        private void PostProcessInput(object sender, ProcessInputEventArgs e)
        {
            if (!e.StagingItem.Input.Handled)
            {
                RoutedEvent routedEvent = e.StagingItem.Input.RoutedEvent;
                if (routedEvent == InputManager.InputReportEvent)
                {
                    InputReportEventArgs input = e.StagingItem.Input as InputReportEventArgs;
                    if (input != null)
                    {
                        RawTouchInputReport report = input.Report as RawTouchInputReport;
                        if (report != null)
                        {
                            TouchEventArgs args = new TouchEventArgs(
                            this,
                            report.Timestamp,
                            report.Touches);

                            UIElement target = report.Target;
                            if (report.EventMessage == (byte)TouchMessages.Down)
                            {
                                args.RoutedEvent = TouchEvents.TouchDownEvent;
                            }
                            else if (report.EventMessage == (byte)TouchMessages.Up)
                            {
                                args.RoutedEvent = TouchEvents.TouchUpEvent;
                            }
                            else if (report.EventMessage == (byte)TouchMessages.Move)
                            {
                                args.RoutedEvent = TouchEvents.TouchMoveEvent;
                            }
                            else
                                throw new Exception("Unknown touch event.");

                            args.Source = (target == null ? _focus : target);
                            e.PushInput(args, e.StagingItem);
                        }
                    }
                }
            }
        }
コード例 #5
0
        private void PostProcessInput(object sender, ProcessInputEventArgs e)
        {
            // PreviewButtonDown --> ButtonDown
            if (e.StagingItem.Input.RoutedEvent == Buttons.PreviewButtonDownEvent)
            {
                CheckForDisconnectedFocus();

                if (!e.StagingItem.Input.Handled)
                {
                    ButtonEventArgs previewButtonDown = (ButtonEventArgs)e.StagingItem.Input;
                    ButtonEventArgs buttonDown = new ButtonEventArgs(this, previewButtonDown.InputSource, previewButtonDown.Timestamp, previewButtonDown.Button);

                    buttonDown._isRepeat = previewButtonDown.IsRepeat;
                    buttonDown.RoutedEvent = Buttons.ButtonDownEvent;

                    e.PushInput(buttonDown, e.StagingItem);
                }
            }

            // PreviewButtonUp --> ButtonUp
            if (e.StagingItem.Input.RoutedEvent == Buttons.PreviewButtonUpEvent)
            {
                CheckForDisconnectedFocus();

                if (!e.StagingItem.Input.Handled)
                {
                    ButtonEventArgs previewButtonUp = (ButtonEventArgs)e.StagingItem.Input;

                    ButtonEventArgs buttonUp = new ButtonEventArgs(this, previewButtonUp.InputSource, previewButtonUp.Timestamp, previewButtonUp.Button);

                    buttonUp.RoutedEvent = Buttons.ButtonUpEvent;

                    e.PushInput(buttonUp, e.StagingItem);
                }
            }

            RawButtonInputReport buttonInput = ExtractRawButtonInputReport(e, InputManager.InputReportEvent);
            if (buttonInput != null)
            {
                CheckForDisconnectedFocus();

                if (!e.StagingItem.Input.Handled)
                {
                    // In general, this is where we promote the non-redundant
                    // reported actions to our premier events.
                    RawButtonActions actions = GetNonRedundantActions(e);

                    // Raw --> PreviewButtonDown
                    if ((actions & RawButtonActions.ButtonDown) == RawButtonActions.ButtonDown)
                    {
                        Button button = (Button)e.StagingItem.GetData(_tagButton);
                        if (button != Button.None)
                        {
                            ButtonEventArgs previewButtonDown = new ButtonEventArgs(this, buttonInput.InputSource, buttonInput.Timestamp, button);
                            previewButtonDown.RoutedEvent = Buttons.PreviewButtonDownEvent;
                            e.PushInput(previewButtonDown, e.StagingItem);
                        }
                    }

                    // Raw --> PreviewButtonUp
                    if ((actions & RawButtonActions.ButtonUp) == RawButtonActions.ButtonUp)
                    {
                        Button button = (Button)e.StagingItem.GetData(_tagButton);
                        if (button != Button.None)
                        {
                            ButtonEventArgs previewButtonUp = new ButtonEventArgs(this, buttonInput.InputSource, buttonInput.Timestamp, button);
                            previewButtonUp.RoutedEvent = Buttons.PreviewButtonUpEvent;
                            e.PushInput(previewButtonUp, e.StagingItem);
                        }
                    }
                }

                // Deactivate
                if ((buttonInput.Actions & RawButtonActions.Deactivate) == RawButtonActions.Deactivate)
                {
                    if (_isActive)
                    {
                        _isActive = false;

                        // Even if handled, a button deactivate results in a lost focus.
                        ChangeFocus(null, e.StagingItem.Input.Timestamp);
                    }
                }
            }
        }
コード例 #6
0
ファイル: ButtonDevice.cs プロジェクト: weimingtom/miniclr
        private void PostProcessInput(object sender, ProcessInputEventArgs e)
        {
            // PreviewButtonDown --> ButtonDown
            if (e.StagingItem.Input.RoutedEvent == Buttons.PreviewButtonDownEvent)
            {
                CheckForDisconnectedFocus();

                if (!e.StagingItem.Input.Handled)
                {
                    ButtonEventArgs previewButtonDown = (ButtonEventArgs)e.StagingItem.Input;
                    ButtonEventArgs buttonDown        = new ButtonEventArgs(this, previewButtonDown.InputSource, previewButtonDown.Timestamp, previewButtonDown.Button);

                    buttonDown._isRepeat   = previewButtonDown.IsRepeat;
                    buttonDown.RoutedEvent = Buttons.ButtonDownEvent;

                    e.PushInput(buttonDown, e.StagingItem);
                }
            }

            // PreviewButtonUp --> ButtonUp
            if (e.StagingItem.Input.RoutedEvent == Buttons.PreviewButtonUpEvent)
            {
                CheckForDisconnectedFocus();

                if (!e.StagingItem.Input.Handled)
                {
                    ButtonEventArgs previewButtonUp = (ButtonEventArgs)e.StagingItem.Input;

                    ButtonEventArgs buttonUp = new ButtonEventArgs(this, previewButtonUp.InputSource, previewButtonUp.Timestamp, previewButtonUp.Button);

                    buttonUp.RoutedEvent = Buttons.ButtonUpEvent;

                    e.PushInput(buttonUp, e.StagingItem);
                }
            }

            RawButtonInputReport buttonInput = ExtractRawButtonInputReport(e, InputManager.InputReportEvent);

            if (buttonInput != null)
            {
                CheckForDisconnectedFocus();

                if (!e.StagingItem.Input.Handled)
                {
                    // In general, this is where we promote the non-redundant
                    // reported actions to our premier events.
                    RawButtonActions actions = GetNonRedundantActions(e);

                    // Raw --> PreviewButtonDown
                    if ((actions & RawButtonActions.ButtonDown) == RawButtonActions.ButtonDown)
                    {
                        Button button = (Button)e.StagingItem.GetData(_tagButton);
                        if (button != Button.None)
                        {
                            ButtonEventArgs previewButtonDown = new ButtonEventArgs(this, buttonInput.InputSource, buttonInput.Timestamp, button);
                            previewButtonDown.RoutedEvent = Buttons.PreviewButtonDownEvent;
                            e.PushInput(previewButtonDown, e.StagingItem);
                        }
                    }

                    // Raw --> PreviewButtonUp
                    if ((actions & RawButtonActions.ButtonUp) == RawButtonActions.ButtonUp)
                    {
                        Button button = (Button)e.StagingItem.GetData(_tagButton);
                        if (button != Button.None)
                        {
                            ButtonEventArgs previewButtonUp = new ButtonEventArgs(this, buttonInput.InputSource, buttonInput.Timestamp, button);
                            previewButtonUp.RoutedEvent = Buttons.PreviewButtonUpEvent;
                            e.PushInput(previewButtonUp, e.StagingItem);
                        }
                    }
                }

                // Deactivate
                if ((buttonInput.Actions & RawButtonActions.Deactivate) == RawButtonActions.Deactivate)
                {
                    if (_isActive)
                    {
                        _isActive = false;

                        // Even if handled, a button deactivate results in a lost focus.
                        ChangeFocus(null, e.StagingItem.Input.Timestamp);
                    }
                }
            }
        }