예제 #1
0
 private void OnEditorTextChanged(object sender, TextChangedEventArgs e)
 {
     if (_isUpdatingText)
     {
         return;
     }
     if (FetchTimer == null)
     {
         FetchTimer          = new DispatcherTimer();
         FetchTimer.Interval = TimeSpan.FromMilliseconds(Delay);
         FetchTimer.Tick    += OnFetchTimerTick;
     }
     FetchTimer.IsEnabled = false;
     FetchTimer.Stop();
     SetSelectedItem(null);
     if (Editor.Text.Length > 0)
     {
         IsLoading                 = true;
         IsDropDownOpen            = true;
         ItemsSelector.ItemsSource = null;
         FetchTimer.IsEnabled      = true;
         FetchTimer.Start();
     }
     else
     {
         IsDropDownOpen = false;
     }
 }
예제 #2
0
 private void OnFetchTimerTick(object sender, EventArgs e)
 {
     FetchTimer.IsEnabled = false;
     FetchTimer.Stop();
     if (Provider != null && ItemsSelector != null)
     {
         Filter = Editor.Text;
         if (_suggestionsAdapter == null)
         {
             _suggestionsAdapter = new SuggestionsAdapter(this);
         }
         _suggestionsAdapter.GetSuggestions(Filter);
     }
 }
예제 #3
0
        private void OnEditorTextChanged(object sender, TextChangedEventArgs e)
        {
            if (_isUpdatingText)
            {
                return;
            }

            if (IsVehicleNumber)
            {
                var s1 = GetVehicleString(Editor.Text);
                if (s1 != Editor.Text)
                {
                    var caretIndex = Editor.CaretIndex;
                    Editor.Text       = s1;
                    Editor.CaretIndex = Math.Min(Editor.Text.Length, caretIndex);
                }
            }

            if (FetchTimer == null)
            {
                FetchTimer          = new DispatcherTimer();
                FetchTimer.Interval = TimeSpan.FromMilliseconds(Delay);
                FetchTimer.Tick    += OnFetchTimerTick;
            }
            FetchTimer.IsEnabled = false;
            FetchTimer.Stop();
            SetSelectedItem(null);
            //if (Editor.Text.Length > 0)
            //{
            IsLoading                 = true;
            IsDropDownOpen            = true;
            ItemsSelector.ItemsSource = null;
            FetchTimer.IsEnabled      = true;
            FetchTimer.Start();
            //}
            //else
            //{
            //    IsDropDownOpen = true;
            //}
        }