예제 #1
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);
                    }
                }
            }
        }
예제 #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;
            }
        }
예제 #6
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;
                    }
                }
            }
        }
예제 #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);
                    }
                }
            }
        }