private void UpdateFoundEntities()
        {
            CanCreateNewEntity = true;
            var result = new List <Entity>();

            using (var worker = new BackgroundWorker())
            {
                worker.DoWork += delegate
                {
                    LocalSettings.UpdateThreadLanguage();
                    result = _entityService.SearchEntities(SelectedEntityType, SearchString, StateFilter);
                };

                worker.RunWorkerCompleted +=
                    delegate
                {
                    _applicationState.MainDispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(
                                                                     delegate
                    {
                        FoundEntities.Clear();
                        FoundEntities.AddRange(result.Select(x => new EntitySearchResultViewModel(x, SelectedEntityType)));
                        RaisePropertyChanged(() => SelectedEntity);
                        CommandManager.InvalidateRequerySuggested();
                    }));
                };

                worker.RunWorkerAsync();
            }
        }
 public void SelectFullMatch()
 {
     if (FoundEntities.Count > 1 && FoundEntities.Any(x => x.Name == SearchString))
     {
         var f = FoundEntities.First(x => x.Name == SearchString);
         FoundEntities.Clear();
         FoundEntities.Add(f);
     }
 }
 private void ResetTimer()
 {
     CanCreateNewEntity = true;
     _updateTimer.Stop();
     if (!string.IsNullOrEmpty(SearchString))
     {
         CanCreateNewEntity = false;
         _updateTimer.Start();
     }
     else
     {
         FoundEntities.Clear();
     }
 }
 public void SelectFullMatch()
 {
     if (_updateTimer.Enabled)
     {
         _updateTimer.Stop();
         UpdateFoundEntities();
     }
     if (FoundEntities.Count > 1 && FoundEntities.Any(x => x.Name == SearchString))
     {
         var f = FoundEntities.First(x => x.Name == SearchString);
         FoundEntities.Clear();
         FoundEntities.Add(f);
     }
     if (SelectEntityCommand.CanExecute(""))
     {
         SelectEntityCommand.Execute("");
     }
 }
 internal void ClearSearchValues()
 {
     FoundEntities.Clear();
     SearchString = "";
 }
Exemple #6
0
 private void ClearSearchValues()
 {
     FoundEntities.Clear();
     SearchString = "";
 }