private void PreProcessMouseInput(object sender, PreProcessInputEventArgs e)
        {
            if (e.Input.Device == Mouse.PrimaryDevice)
            {
                if (e.Input.RoutedEvent == Mouse.MouseLeftButtonDownEvent)
                {
                    IInputElement element = e.Input.OriginalSource as IInputElement;

                    if (element != null)
                    {
                        this.Focus(element);
                    }
                }
            }
        }
示例#2
0
        private void PreProcessMouseInput(object sender, PreProcessInputEventArgs e)
        {
            if (e.Input.Device == this)
            {
                RawMouseEventArgs rawMouseEvent = e.Input as RawMouseEventArgs;

                if (rawMouseEvent != null)
                {
                    if (this.ProcessRawMouseEvent(rawMouseEvent))
                    {
                        e.Cancel();
                    }
                }
                else if (e.Input.RoutedEvent == UIElement.MouseMoveEvent)
                {
                    this.UpdateUIElementMouseOvers();
                }
            }
        }
示例#3
0
        private void PreProcessMouseInput(object sender, PreProcessInputEventArgs e)
        {
            if (e.Input.Device == this)
            {
                RawMouseEventArgs rawMouseEvent = e.Input as RawMouseEventArgs;

                if (rawMouseEvent != null)
                {
                    if (this.ProcessRawMouseEvent(rawMouseEvent))
                    {
                        e.Cancel();
                    }
                }
                else if (e.Input.RoutedEvent == UIElement.MouseMoveEvent)
                {
                    this.UpdateUIElementMouseOvers();
                }
            }
        }
示例#4
0
        private void ProcessStack()
        {
            if (!this.processing)
            {
                this.processing = true;

                while (this.stack.Count > 0)
                {
                    InputEventArgs input = this.stack.Pop();

                    try
                    {
                        PreProcessInputEventArgs e = new PreProcessInputEventArgs(input);

                        input.OriginalSource = input.Device.Target;

                        if (this.PreProcessInput != null)
                        {
                            foreach (var handler in this.PreProcessInput.GetInvocationList().Reverse())
                            {
                                handler.DynamicInvoke(this, e);
                            }
                        }

                        if (!e.Canceled)
                        {
                            UIElement uiElement = input.OriginalSource as UIElement;

                            if (uiElement != null)
                            {
                                uiElement.RaiseEvent(input);
                            }
                        }
                    }
                    catch
                    {
                    }
                }

                this.processing = false;
            }
        }
示例#5
0
        private void ProcessStack()
        {
            if (!this.processing)
            {
                this.processing = true;

                while (this.stack.Count > 0)
                {
                    InputEventArgs input = this.stack.Pop();

                    try
                    {
                        PreProcessInputEventArgs e = new PreProcessInputEventArgs(input);

                        input.OriginalSource = input.Device.Target;

                        if (this.PreProcessInput != null)
                        {
                            foreach (var handler in this.PreProcessInput.GetInvocationList().Reverse())
                            {
                                handler.DynamicInvoke(this, e);
                            }
                        }

                        if (!e.Canceled)
                        {
                            UIElement uiElement = input.OriginalSource as UIElement;

                            if (uiElement != null)
                            {
                                uiElement.RaiseEvent(input);
                            }
                        }
                    }
                    catch
                    {
                    }
                }

                this.processing = false;
            }
        }
        private void PreProcessKeyboardInput(object sender, PreProcessInputEventArgs e)
        {
            if (e.Input.Device == this)
            {
                RawKeyEventArgs rawKeyEvent = e.Input as RawKeyEventArgs;

                if (rawKeyEvent != null)
                {
                    switch (rawKeyEvent.Type)
                    {
                    case RawKeyEventType.KeyDown:
                        KeyEventArgs ek = new KeyEventArgs(
                            (KeyboardDevice)rawKeyEvent.Device,
                            Mouse.PrimaryDevice.ActiveSource,
                            rawKeyEvent.Timestamp,
                            rawKeyEvent.Key);
                        ek.RoutedEvent = Keyboard.KeyDownEvent;
                        InputManager.Current.ProcessInput(ek);
                        e.Cancel();
                        break;
                    }
                }
            }
        }
示例#7
0
        private void PreProcessKeyboardInput(object sender, PreProcessInputEventArgs e)
        {
            if (e.Input.Device == this)
            {
                RawKeyEventArgs rawKeyEvent = e.Input as RawKeyEventArgs;

                if (rawKeyEvent != null)
                {
                    switch (rawKeyEvent.Type)
                    {
                        case RawKeyEventType.KeyDown:
                            KeyEventArgs ek = new KeyEventArgs(
                                (KeyboardDevice)rawKeyEvent.Device,
                                Mouse.PrimaryDevice.ActiveSource,
                                rawKeyEvent.Timestamp,
                                rawKeyEvent.Key);
                            ek.RoutedEvent = Keyboard.KeyDownEvent;
                            InputManager.Current.ProcessInput(ek);
                            e.Cancel();
                            break;
                    }
                }
            }
        }
示例#8
0
        private void PreProcessMouseInput(object sender, PreProcessInputEventArgs e)
        {
            if (e.Input.Device == Mouse.PrimaryDevice)
            {
                if (e.Input.RoutedEvent == Mouse.MouseLeftButtonDownEvent)
                {
                    IInputElement element = e.Input.OriginalSource as IInputElement;

                    if (element != null)
                    {
                        this.Focus(element);
                    }
                }
            }
        }