private uint Filter(NameFilterParams filterParameters) { lock (_lock) { _control.Filter(filterParameters); _lastFilter = filterParameters; } return(0); }
public void RefreshFilter() { var filterParameters = new NameFilterParams(_lastFilter?.FilterString, _lastFilter?.MatchCase ?? false, ShowTables, ShowProcedures); Filter(filterParameters); }
protected override void OnStartSearch() { // Use the original content of the text box as the target of the search. //var separator = new string[] { Environment.NewLine }; //var control = (SqlExplorerControl)m_toolWindow.Content; //string[] contentArr = control.Files.Split(separator, StringSplitOptions.None); //// Get the search option. //bool matchCase = m_toolWindow.MatchCaseOption.Value; //// Set variables that are used in the finally block. //StringBuilder sb = new StringBuilder(""); //uint resultCount = 0; //this.ErrorCode = VSConstants.S_OK; //try //{ // string searchString = this.SearchQuery.SearchString; // // Determine the results. // uint progress = 0; // foreach (string line in contentArr) // { // if (matchCase == true) // { // if (line.Contains(searchString)) // { // sb.AppendLine(line); // resultCount++; // } // } // else // { // if (line.ToLower().Contains(searchString.ToLower())) // { // sb.AppendLine(line); // resultCount++; // } // } // SearchCallback.ReportProgress(this, progress++, (uint)contentArr.GetLength(0)); // } //} //catch (Exception e) //{ // this.ErrorCode = VSConstants.E_FAIL; //} //finally //{ // this.SearchResults = resultCount; //} ErrorCode = VSConstants.S_OK; var filterParameters = new NameFilterParams(SearchQuery.SearchString, _toolWindow.MatchCaseOption.Value, _toolWindow.ShowTables, _toolWindow.ShowProcedures); ThreadHelper.Generic.Invoke(() => { uint resultCount = 0; try { resultCount = _toolWindow.Filter(filterParameters); } catch (Exception) { ErrorCode = VSConstants.E_FAIL; } SearchResults = resultCount; SearchCallback.ReportComplete(this, resultCount); }); // Call the implementation of this method in the base class. // This sets the task status to complete and reports task completion. base.OnStartSearch(); }