public TextBoxDelayHandler(TextBox textBox, int delayMs)
        {
            _textBox = textBox;
            _timer   = new Timer()
            {
                Interval = delayMs
            };
            _timer.Tick += delegate(object sender, EventArgs e)
            {
                _timer.Stop();
                DelayedTextChanged?.Invoke(_textBox, e);
            };

            _textBox.TextChanged += StartTimer;
        }
Exemplo n.º 2
0
 public TextDelayedInput()
 {
     _filterInvoke = new DispatcherTimer()
     {
         Interval  = TimeSpan.FromMilliseconds(1000),
         IsEnabled = false
     };
     _filterInvoke.Tick += (s, a) =>
     {
         var text = Text;
         if (!string.Equals(_lastValue, text))
         {
             _filterInvoke.Stop();
             DelayedTextChanged?.Invoke(this, text);
             _lastValue = text;
         }
     };
 }
Exemplo n.º 3
0
 protected virtual void OnDelayedTextChanged(EventArgs e)
 {
     DelayedTextChanged?.Invoke(this, e);
 }