コード例 #1
0
 public static void TypeAndSearch(string searchText)
 {
     SearchTextbox.Clear();
     SearchTextbox.SendKeys(searchText);
     SearchButton.Click();
     CurrentDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
 }
コード例 #2
0
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                listbox1.ItemsSource = null;

                if (SearchButton.IsChecked == true)
                {
                    listbox1.Items.Clear();
                    SearchButton.Content = "Search Off";


                    IEnumerable <Product> foundObjects = ComplateProductsList.Where((myObject) => myObject.ProductName.Equals(SearchTextbox.Text, StringComparison.OrdinalIgnoreCase));


                    //v = ComplateProductsList.FindAll(y => y.ProductName == SearchTextbox.Text);


                    //var result = ComplateProductsList.Where(x => x.ProductName == SearchTextbox.Text);
                    listbox1.ItemsSource = foundObjects;
                }


                else
                {
                    listbox1.ItemsSource = null;
                    SearchButton.Content = "Search On";

                    listbox1.ItemsSource = ComplateProductsList;

                    SearchTextbox.Clear();
                }
            }
            catch (Exception)
            {
            }
        }