コード例 #1
0
        public void UIEventHub_Handler(object o, RoutedEventArgs e)
        {
            //Create an UIInput from event.
            IUIInput input = UIInputBase.FromEventArgs(o, e as InputEventArgs);

            if (cbEvent.IsChecked.Value && input.InputState != UIInputState.NotApplied)
            {
                addOutput(input.ToString());
            }

            //Use inputprocessors to process the input
            _inputProcessors.Update(ref input);

            if (cbClickCount.IsChecked.Value && input.ClickCount > 1)
            {
                addOutput("ClickCount " + input.ClickCount.ToString());
            }

            if (cbTouchGesture.IsChecked.Value && input.TouchGesture != UITouchGesture.NotApplied && input.TouchGesture != UITouchGesture.Drag)
            {
                addOutput(input.TouchGesture.ToString());
            }

            if (cbRawEvent.IsChecked.Value)
            {
                if (e is MouseButtonEventArgs)
                {
                    MouseButtonEventArgs me = e as MouseButtonEventArgs;
                    addOutput(String.Format("{0} : {1} {2}", me.RoutedEvent, me.ChangedButton, me.GetPosition(null)));
                }
                else if (e is MouseEventArgs)
                {
                    MouseEventArgs me = e as MouseEventArgs;
                    addOutput(String.Format("{0} : {1}", me.RoutedEvent, me.GetPosition(null)));
                }
                else if (e is TouchEventArgs)
                {
                    TouchEventArgs te = e as TouchEventArgs;
                    addOutput(String.Format("{0} : {1}", te.RoutedEvent, te.GetTouchPoint(null)));
                }
                else
                {
                    addOutput(e.ToString());
                }
            }
        }