Exemple #1
0
            protected override void ExecuteDefaultActionAtTarget(EventBase evt)
            {
                base.ExecuteDefaultActionAtTarget(evt);

                if (evt == null)
                {
                    return;
                }

                if (evt.eventTypeId == KeyDownEvent.TypeId())
                {
                    KeyDownEvent kde = evt as KeyDownEvent;

                    if (!parentTextField.isDelayed || (!multiline && ((kde?.keyCode == KeyCode.KeypadEnter) || (kde?.keyCode == KeyCode.Return))))
                    {
                        parentTextField.value = text;
                    }

                    if (multiline)
                    {
                        if (kde?.character == '\t' && kde.modifiers == EventModifiers.None)
                        {
                            kde?.StopPropagation();
                            kde?.PreventDefault();
                        }
                        else if (((kde?.character == 3) && (kde?.shiftKey == true)) ||  // KeyCode.KeypadEnter
                                 ((kde?.character == '\n') && (kde?.shiftKey == true))) // KeyCode.Return
                        {
                            parent.Focus();
                            evt.StopPropagation();
                            evt.PreventDefault();
                        }
                    }
                    else if ((kde?.character == 3) ||    // KeyCode.KeypadEnter
                             (kde?.character == '\n'))   // KeyCode.Return
                    {
                        parent.Focus();
                        evt.StopPropagation();
                        evt.PreventDefault();
                    }
                }
                else if (evt.eventTypeId == ExecuteCommandEvent.TypeId())
                {
                    ExecuteCommandEvent commandEvt = evt as ExecuteCommandEvent;
                    string cmdName = commandEvt.commandName;
                    if (!parentTextField.isDelayed && (cmdName == EventCommandNames.Paste || cmdName == EventCommandNames.Cut))
                    {
                        parentTextField.value = text;
                    }
                }
                // Prevent duplicated navigation events, since we're observing KeyDownEvents instead
                else if (evt.eventTypeId == NavigationSubmitEvent.TypeId() ||
                         evt.eventTypeId == NavigationCancelEvent.TypeId() ||
                         evt.eventTypeId == NavigationMoveEvent.TypeId())
                {
                    evt.StopPropagation();
                    evt.PreventDefault();
                }
            }
            protected internal override void ExecuteDefaultActionAtTarget(EventBase evt)
            {
                base.ExecuteDefaultActionAtTarget(evt);
                if (evt == null)
                {
                    return;
                }

                if (evt.eventTypeId == KeyDownEvent.TypeId())
                {
                    KeyDownEvent kde = evt as KeyDownEvent;

                    if (!parentTextField.isDelayed || (!multiline && ((kde?.keyCode == KeyCode.KeypadEnter) || (kde?.keyCode == KeyCode.Return))))
                    {
                        parentTextField.value = text;
                    }

                    if (multiline)
                    {
                        if (kde?.character == '\t')
                        {
                            kde?.StopPropagation();
                            kde?.PreventDefault();
                        }
                        else if (((kde?.character == 3) && (kde?.shiftKey == true)) ||  // KeyCode.KeypadEnter
                                 ((kde?.character == '\n') && (kde?.shiftKey == true))) // KeyCode.Return
                        {
                            parent.Focus();
                        }
                    }
                    else if ((kde?.character == 3) ||    // KeyCode.KeypadEnter
                             (kde?.character == '\n'))   // KeyCode.Return
                    {
                        parent.Focus();
                    }
                }
                else if (evt.eventTypeId == ExecuteCommandEvent.TypeId())
                {
                    ExecuteCommandEvent commandEvt = evt as ExecuteCommandEvent;
                    string cmdName = commandEvt.commandName;
                    if (!parentTextField.isDelayed && (cmdName == EventCommandNames.Paste || cmdName == EventCommandNames.Cut))
                    {
                        parentTextField.value = text;
                    }
                }
            }
Exemple #3
0
            protected override void ExecuteDefaultActionAtTarget(EventBase evt)
            {
                base.ExecuteDefaultActionAtTarget(evt);
                bool flag = evt == null;

                if (!flag)
                {
                    bool flag2 = evt.eventTypeId == EventBase <KeyDownEvent> .TypeId();

                    if (flag2)
                    {
                        KeyDownEvent keyDownEvent = evt as KeyDownEvent;
                        bool         flag3        = !this.parentTextField.isDelayed || (!this.multiline && ((keyDownEvent != null && keyDownEvent.keyCode == KeyCode.KeypadEnter) || (keyDownEvent != null && keyDownEvent.keyCode == KeyCode.Return)));
                        if (flag3)
                        {
                            this.parentTextField.value = base.text;
                        }
                        bool multiline = this.multiline;
                        if (multiline)
                        {
                            char?c     = (keyDownEvent != null) ? new char?(keyDownEvent.character) : null;
                            int? num   = c.HasValue ? new int?((int)c.GetValueOrDefault()) : null;
                            int  num2  = 9;
                            bool flag4 = (num.GetValueOrDefault() == num2 & num.HasValue) && keyDownEvent.modifiers == EventModifiers.None;
                            if (flag4)
                            {
                                if (keyDownEvent != null)
                                {
                                    keyDownEvent.StopPropagation();
                                }
                                if (keyDownEvent != null)
                                {
                                    keyDownEvent.PreventDefault();
                                }
                            }
                            else
                            {
                                c    = ((keyDownEvent != null) ? new char?(keyDownEvent.character) : null);
                                num  = (c.HasValue ? new int?((int)c.GetValueOrDefault()) : null);
                                num2 = 3;
                                bool arg_1EE_0;
                                if (!(num.GetValueOrDefault() == num2 & num.HasValue) || keyDownEvent == null || !keyDownEvent.shiftKey)
                                {
                                    c         = ((keyDownEvent != null) ? new char?(keyDownEvent.character) : null);
                                    num       = (c.HasValue ? new int?((int)c.GetValueOrDefault()) : null);
                                    num2      = 10;
                                    arg_1EE_0 = ((num.GetValueOrDefault() == num2 & num.HasValue) && keyDownEvent != null && keyDownEvent.shiftKey);
                                }
                                else
                                {
                                    arg_1EE_0 = true;
                                }
                                bool flag5 = arg_1EE_0;
                                if (flag5)
                                {
                                    base.parent.Focus();
                                }
                            }
                        }
                        else
                        {
                            char?c    = (keyDownEvent != null) ? new char?(keyDownEvent.character) : null;
                            int? num  = c.HasValue ? new int?((int)c.GetValueOrDefault()) : null;
                            int  num2 = 3;
                            bool arg_2B8_0;
                            if (!(num.GetValueOrDefault() == num2 & num.HasValue))
                            {
                                c         = ((keyDownEvent != null) ? new char?(keyDownEvent.character) : null);
                                num       = (c.HasValue ? new int?((int)c.GetValueOrDefault()) : null);
                                num2      = 10;
                                arg_2B8_0 = (num.GetValueOrDefault() == num2 & num.HasValue);
                            }
                            else
                            {
                                arg_2B8_0 = true;
                            }
                            bool flag6 = arg_2B8_0;
                            if (flag6)
                            {
                                base.parent.Focus();
                            }
                        }
                    }
                    else
                    {
                        bool flag7 = evt.eventTypeId == EventBase <ExecuteCommandEvent> .TypeId();

                        if (flag7)
                        {
                            ExecuteCommandEvent executeCommandEvent = evt as ExecuteCommandEvent;
                            string commandName = executeCommandEvent.commandName;
                            bool   flag8       = !this.parentTextField.isDelayed && (commandName == "Paste" || commandName == "Cut");
                            if (flag8)
                            {
                                this.parentTextField.value = base.text;
                            }
                        }
                        else
                        {
                            NavigationDirection navigationDirection;
                            bool flag9 = base.eventInterpreter.IsActivationEvent(evt) || base.eventInterpreter.IsCancellationEvent(evt) || (base.eventInterpreter.IsNavigationEvent(evt, out navigationDirection) && navigationDirection != NavigationDirection.Previous && navigationDirection != NavigationDirection.Next);
                            if (flag9)
                            {
                                evt.StopPropagation();
                                evt.PreventDefault();
                            }
                        }
                    }
                }
            }