public StartUp() { InitializeComponent(); pm = DLLFacade.CreateManager(AccessType.Memory); try { people = pm.GetPersons(); LstPerson.ItemsSource = people; } catch (Exception ex) { MessageBox.Show($"{ex.Message}\n{ex.StackTrace}", "Error!!!444", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } Options.ItemsSource = Enum.GetValues(typeof(AccessType)).Cast <AccessType>(); var textchanges = Observable.FromEventPattern <TextChangedEventHandler, TextChangedEventArgs>( h => txtUserEntry.TextChanged += h, h => txtUserEntry.TextChanged -= h ).Select(x => ((TextBox)x.Sender).Text); textchanges .Throttle(TimeSpan.FromMilliseconds(300)) // result on threadpool .Select(Lookfor) .Switch() .ObserveOnDispatcher() // send back to dispatcher .Subscribe(OnSearchResult); Lookfor("").Subscribe(OnSearchResult); }
public DataAccessViewModel() { _personManager = DLLFacade.CreateManager(AccessType.Memory); People = new BindableCollection <Person>(_personManager.GetPersons()); }
//protected void NavigationService_LoadCompleted(object sender, NavigationEventArgs e) //{ // if (e.ExtraData is Person) // { // pm.AddPerson((Person)e.ExtraData); // LstPerson.ItemsSource = pm.GetPersons(); // } //} private void Options_SelectionChanged(object sender, SelectionChangedEventArgs e) { pm = DLLFacade.CreateManager((AccessType)Enum.Parse(typeof(AccessType), Options.SelectedItem.ToString())); LstPerson.ItemsSource = pm.GetPersons(); }