Ejemplo n.º 1
0
 private void _codeEditor_TextEntered(object sender, TextInputEventArgs e)
 {
     if (!_codeEditor.IsReadOnly)
     {
         TextEntered?.Invoke(this, e);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Force an callback as if you hit the Enter Key.
        /// </summary>
        private void FireEnter(object sender, RoutedEventArgs e)
        {
            // Remove selected text (completion guess), so we only get what the user typed
            var selectionLength = GetTextBox().SelectionLength;
            var text            = GetTextBox().Text;

            // the selection is the whole textbox, go ahead and leave it.
            if (selectionLength != 0 && selectionLength != GetTextBox().Text.Length)
            {
                GetTextBox().Text = text.Substring(0, GetTextBox().SelectionStart);
            }

            if (text.Length > 0)
            {
                AddToHistory(Text);
            }

            // Logically we have lost focus.  (Any way of giving it up for real?)
            m_hasFocus = false;

            var enter = Enter;

            if (enter != null)
            {
                Enter(sender, e);
            }

            TextEntered?.Invoke(sender, e);

            ValueUpdate();
        }
Ejemplo n.º 3
0
        internal bool HandledTextInput(UnicodeInputEventArgs e)
        {
            if (!visible || !enabled)
            {
                return(false);
            }

            for (var index = children.Count - 1; index >= 0; --index)
            {
                if (children[index].HandledTextInput(e))
                {
                    return(true);
                }
            }

            if (!RegisterEventTypes.HasFlag(EventType.TextEntered) || !HasFocus)
            {
                return(false);
            }

            OnTextEntered(e.CodePoint, e.Modifiers);
            TextEntered?.Invoke(this, e);

            return(true);
        }
Ejemplo n.º 4
0
        protected override void CustomInputHandle(ConsoleKey key)
        {
            var isLetter = key >= ConsoleKey.A && key <= ConsoleKey.Z;
            var isNumber = key >= ConsoleKey.D1 && key <= ConsoleKey.D0;
            var value    = key.ToString().ToLower();

            if (isLetter || isNumber)
            {
                promptBox.TextElement.AppendText(value);
                Invalidate(false);
            }
            else if (key == ConsoleKey.Backspace)
            {
                promptBox.Text = promptBox.Text.Remove(promptBox.Text.Length - 1);
                Invalidate(false);
            }
            else if (key == ConsoleKey.Enter)
            {
                Console.CursorVisible = false;
                Close();
                TextEntered?.Invoke(this, promptBox.Text);
            }
            else
            {
                Invalidate(true);
            }
        }
Ejemplo n.º 5
0
 public WindowWrapperInput(Window window)
 {
     _window                     = window;
     window.TextEntered         += (sender, args) => TextEntered?.Invoke(args);
     window.KeyPressed          += (sender, args) => KeyPressed?.Invoke(args);
     window.MouseButtonPressed  += (sender, args) => MouseButtonDown?.Invoke(args);
     window.MouseButtonReleased += (sender, args) => MouseButtonUp?.Invoke(args);
     window.MouseMoved          += (sender, args) => MouseMoved?.Invoke(args);
     window.MouseWheelScrolled  += (sender, args) => MouseWheelScrolled?.Invoke(args);
 }
Ejemplo n.º 6
0
        private void OnTextEntered(TextEventArgs args)
        {
            var initialBlocked = _blocked;

            TextEntered?.Invoke(args);

            if (!_blocked && initialBlocked == _blocked)
            {
                BlockableTextEntered?.Invoke(args);
            }
        }
Ejemplo n.º 7
0
 public void Start()
 {
     Task.Run(() =>
     {
         while (true)
         {
             var line = Console.ReadLine();
             TextEntered?.Invoke(line);
         }
     });
 }
Ejemplo n.º 8
0
        private void OnCommandLineTextEntered()
        {
            WriteLine(textField.GetComponent <UI.Text>().text);
            var text = textField.text;

            textField.text = "";
            if (text.Length != 0)
            {
                histroy.Add(text);
            }
            histroyIndex = 0;
            TextEntered?.Invoke(text);
        }
Ejemplo n.º 9
0
        private async Task StartInternal()
        {
            _isStarted = true;
            _consoleAbstraction.Clear();
            _lineReaderWithPrompt.Start();
            _consoleAbstraction.DrawSeparatorOnLine(_numberOfLines, ".");

            while (_isStarted)
            {
                var text = await _lineReaderWithPrompt.ReadLineAsync();

                TextEntered?.Invoke(text);
            }
        }
Ejemplo n.º 10
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Return))
     {
         TextEntered?.Invoke();
     }
     else if (Input.GetKeyDown(KeyCode.DownArrow))
     {
         HistoryDown?.Invoke();
     }
     else if (Input.GetKeyDown(KeyCode.UpArrow))
     {
         HistoryUp?.Invoke();
     }
 }
Ejemplo n.º 11
0
        private void Entry_OnCompleted(object sender, EventArgs e)
        {
            if (!canPop)
            {
                return;
            }
            canPop = false;
            if (string.IsNullOrEmpty(Text))
            {
                return;
            }

            TextEntered?.Invoke(this, Text);
            //Navigation.PopAsync();
        }
Ejemplo n.º 12
0
        private void DoLostFocus(object sender, RoutedEventArgs e)
        {
            bool prevFocus = m_hasFocus;

            m_hasFocus = false;
            if (m_origBackground != null)
            {
                Background = m_origBackground;
            }

            if (prevFocus)
            {
                TextEntered?.Invoke(sender, e);
                ValueUpdate();
            }
        }
Ejemplo n.º 13
0
        public override void OnKeyDown(Keys key)
        {
            if (key == Keys.Enter)
            {
                if (!string.IsNullOrWhiteSpace(CurrentText))
                {
                    TextEntered?.Invoke(CurrentText);
                }
            }

            if (key == Keys.Backspace)
            {
                if (CurrentText.Length > 0)
                {
                    CurrentText = CurrentText.Substring(0, CurrentText.Length - 1);
                }
            }
        }
Ejemplo n.º 14
0
        public InputEvents(RenderWindow window)
        {
            // if dummy don't attach events
            if (window == null)
            {
                return;
            }

            _window = window;

            _window.KeyPressed          += (sender, args) => KeyPressed?.Invoke(sender, args);
            _window.KeyReleased         += (sender, args) => KeyReleased?.Invoke(sender, args);
            _window.MouseButtonPressed  += (sender, args) => MouseButtonPressed?.Invoke(sender, args);
            _window.MouseButtonReleased += (sender, args) => MouseButtonReleased?.Invoke(sender, args);
            _window.MouseMoved          += (sender, args) => MouseMoved?.Invoke(sender, args);
            _window.MouseWheelMoved     += (sender, args) => MouseWheelMoved?.Invoke(sender, args);
            _window.MouseEntered        += (sender, args) => MouseEntered?.Invoke(sender, args);
            _window.MouseLeft           += (sender, args) => MouseLeft?.Invoke(sender, args);
            _window.TextEntered         += (sender, args) => TextEntered?.Invoke(sender, args);
        }
Ejemplo n.º 15
0
        public InputEvents(CluwneWindow window)
        {
            // if dummy don't attach events
            if (window == null)
            {
                return;
            }

            SFML.Graphics.RenderWindow SWindow = window.SFMLWindow;

            SWindow.KeyPressed          += (sender, args) => KeyPressed?.Invoke(sender, (KeyEventArgs)args);
            SWindow.KeyReleased         += (sender, args) => KeyReleased?.Invoke(sender, (KeyEventArgs)args);
            SWindow.MouseButtonPressed  += (sender, args) => MouseButtonPressed?.Invoke(sender, (MouseButtonEventArgs)args);
            SWindow.MouseButtonReleased += (sender, args) => MouseButtonReleased?.Invoke(sender, (MouseButtonEventArgs)args);
            SWindow.MouseMoved          += (sender, args) => MouseMoved?.Invoke(sender, (MouseMoveEventArgs)args);
            SWindow.MouseWheelScrolled  += (sender, args) => MouseWheelMoved?.Invoke(sender, (MouseWheelScrollEventArgs)args);
            SWindow.MouseEntered        += (sender, args) => MouseEntered?.Invoke(sender, args);
            SWindow.MouseLeft           += (sender, args) => MouseLeft?.Invoke(sender, args);
            SWindow.TextEntered         += (sender, args) => TextEntered?.Invoke(sender, (TextEventArgs)args);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Force an callback as if you hit the Enter Key.
        /// </summary>
        private void FireEnter(object sender, RoutedEventArgs e)
        {
            var text = GetTextBox().Text;

            if (text.Length > 0)
            {
                AddToHistory(Text);
            }

            // Logically we have lost focus.  (Any way of giving it up for real?)
            m_hasFocus = false;

            var enter = Enter;

            if (enter != null)
            {
                Enter(sender, e);
            }

            TextEntered?.Invoke(sender, e);

            ValueUpdate();
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Protected overridable handler that raises TextEntered event.
 /// </summary>
 protected virtual void OnTextEntered(TextEventArgs args)
 {
     TextEntered?.Invoke(this, args);
 }
Ejemplo n.º 18
0
 private void OnText(object obj, int position)
 {
     TextEntered?.Invoke(obj, position);
     Items[position].IsCompleted = true;
     //CheckForChildren(position);
 }
 private void OnTextEntered(string text) => TextEntered?.Invoke(text);
Ejemplo n.º 20
0
 public void SetText(string text)
 {
     TextEntered?.Invoke(this, text);
 }
Ejemplo n.º 21
0
 private void OnTextEntered()
 {
     TextEntered?.Invoke(this);
 }