Ejemplo n.º 1
0
 public void Search_Employee(object sender, TextChangedEventArgs e)
 {
     if (MainSearchBar.Text != string.Empty || MainSearchBar.Text != "")
     {
         try
         {
             viewModel.Employees.Clear();
             IEnumerable <Employee> searchresult = viewModel.DataStore.GetAllAsync(x => x.Name.ToLower().Contains(MainSearchBar.Text.ToLower())).Result.ToList();
             foreach (var item in searchresult)
             {
                 viewModel.Employees.Add(item);
             }
         }catch (Exception ex)
         {
             Debug.WriteLine(ex);
         }
         finally
         {
             listview1.ItemsSource = viewModel.EmployeeList;
         }
     }
     else
     {
         viewModel.ExecuteLoadEmployeeCommand();
         BindingContext = viewModel;
     }
 }