示例#1
0
        public void search()
        {
            SearchCriteria searchCriteria;
            SearchDetails  searchDetails;

            if (!SearchForm.parameterise(out searchCriteria, out searchDetails, getSelectedFileSystemInfosOrCurrentDirectoryOrEmpty(), getSelectedFilterOrAny(), this))
            {
                return;
            }
            SearchDetailsRepository.commit(searchDetails);
            String    filter = (String.IsNullOrWhiteSpace(searchCriteria.filter)) ? Filters.any : searchCriteria.filter;
            ISearcher searcher;

            try {
                                #if USE_MOCK_SEARCHER
                searcher = new SleepyMockSearcher(filter);
                                #else
                if (null == searchCriteria.xpath)
                {
                    searcher = new UnsophisticatedSearcher(searchCriteria.regex, filter);
                }
                else
                {
                    searcher = new SophisticatedSearcher(searchCriteria.regex, searchCriteria.xpath, filter);
                }
                                #endif

                searchWith(searcher, searchCriteria);
            }
            catch (Exception exception) {
                this.error(exception);
            }
        }
 public void populate()
 {
     using (new ListViewUpdate(listView)) {
         listView.Items.Clear();
         foreach (SearchDetails searchDetails in SearchDetailsRepository.enumerate())
         {
             listView.Items.Add(
                 new ListViewItem()
             {
                 Text = searchDetails.searchType.ToString(), Tag = searchDetails
             }.withSubItems(
                     new ListViewItem.ListViewSubItem()
             {
                 Text = searchDetails.pattern
             },
                     new ListViewItem.ListViewSubItem()
             {
                 Text = searchDetails.regexOptions.ToString()
             },
                     new ListViewItem.ListViewSubItem()
             {
                 Text = searchDetails.xpath
             },
                     new ListViewItem.ListViewSubItem()
             {
                 Text = searchDetails.filter
             },
                     new ListViewItem.ListViewSubItem()
             {
                 Text = String.Join(", ", searchDetails.paths)
             }
                     )
                 );
         }
         listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     }
 }