コード例 #1
0
 public SearchProgressChangedEventArgs(
     string criteria,
     GridSearchResultCellInfo cell,
     GridSearchResultCellCollection cells,
     bool searchFinished)
 {
     this.searchCriteria = criteria;
     this.cell           = cell;
     this.cells          = cells;
     this.searchFinished = searchFinished;
 }
コード例 #2
0
 protected virtual void SetCurrent(GridSearchResultCellInfo cell, bool checkInvokeRequired)
 {
     if (this.ViewTemplate.MasterTemplate.Owner.InvokeRequired)
     {
         this.ViewTemplate.MasterTemplate.Owner.Invoke((Delegate) new GridViewSearchRowInfo.SetCurrentHandler(this.SetCurrent), (object)cell);
     }
     else
     {
         this.SetCurrent(cell);
     }
 }
コード例 #3
0
 protected virtual void ReportSearchProgress(
     int percent,
     GridSearchResultCellInfo resultCell,
     GridSearchResultCellCollection resultCells)
 {
     if (resultCell != null)
     {
         this.searchResult.Add(resultCell);
         if (this.searchResult.Count == 1 && this.AutomaticallySelectFirstResult)
         {
             this.SelectNextSearchResult();
         }
     }
     else if (resultCells != null)
     {
         foreach (GridSearchResultCellInfo resultCell1 in (List <GridSearchResultCellInfo>)resultCells)
         {
             this.searchResult.Add(resultCell1);
         }
     }
     this.OnSearchProgressChanged(new SearchProgressChangedEventArgs(this.searchCriteria, resultCell, resultCells, percent == 100));
 }
コード例 #4
0
 protected virtual void SetCurrent(GridSearchResultCellInfo cell)
 {
     this.EnsurePageVisible(cell.RowInfo);
     this.ViewTemplate.MasterTemplate.Owner.CurrentRow    = cell.RowInfo;
     this.ViewTemplate.MasterTemplate.Owner.CurrentColumn = cell.ColumnInfo;
 }
コード例 #5
0
        protected virtual void TraverseRows(DoWorkEventArgs e = null)
        {
            if (e != null)
            {
                e.Result = (object)false;
            }
            bool            flag       = false;
            GridViewRowInfo currentRow = this.ViewTemplate.MasterTemplate.Owner.CurrentRow;
            GridSearchResultCellCollection resultCells = (GridSearchResultCellCollection)null;
            IEnumerator enumerator = (IEnumerator)this.CreateTraverser();

            if (this.ViewTemplate.MasterTemplate.EnablePaging)
            {
                enumerator = this.CreatePagedTraverser(this.ViewTemplate.MasterTemplate.EnableGrouping && this.ViewTemplate.MasterTemplate.GroupDescriptors.Count > 0);
            }
            int traverserRowIndex = -1;

            while (enumerator.MoveNext())
            {
                ++traverserRowIndex;
                if (GridViewSearchRowInfo.Cancel && !this.IsSearchAsync)
                {
                    GridViewSearchRowInfo.Cancel = false;
                    e.Result = (object)true;
                    return;
                }
                if (!(enumerator.Current is GridViewTableHeaderRowInfo) && !(enumerator.Current is GridViewNewRowInfo) && (!(enumerator.Current is GridViewFilteringRowInfo) && !(enumerator.Current is GridViewSearchRowInfo)))
                {
                    if (this.SearchFromCurrentPosition)
                    {
                        if (enumerator.Current == currentRow)
                        {
                            flag = true;
                        }
                        if (currentRow != null && !flag)
                        {
                            continue;
                        }
                    }
                    GridViewGroupRowInfo current1 = enumerator.Current as GridViewGroupRowInfo;
                    if (current1 != null)
                    {
                        if (GridViewSearchRowInfo.Cancel && !this.IsSearchAsync)
                        {
                            GridViewSearchRowInfo.Cancel = false;
                            e.Result = (object)true;
                            return;
                        }
                        if (this.MatchesSearchCriteria(this.searchCriteria, (GridViewRowInfo)current1, (GridViewColumn)null))
                        {
                            GridViewColumn groupedColumnInfo = this.GetGroupedColumnInfo(current1);
                            if (current1.SearchCache.ContainsKey((object)groupedColumnInfo))
                            {
                                current1.SearchCache[(object)groupedColumnInfo] = (object)this.searchCriteria;
                            }
                            else
                            {
                                current1.SearchCache.Add((object)groupedColumnInfo, (object)this.searchCriteria);
                            }
                            GridSearchResultCellInfo resultCell = new GridSearchResultCellInfo((GridViewRowInfo)current1, (GridViewColumn)null, traverserRowIndex, 0);
                            if (this.searchResult.Count < this.InitialSearchResultsTreshold)
                            {
                                this.ReportSearchProgress(0, resultCell, (GridSearchResultCellCollection)null);
                            }
                            else
                            {
                                if (resultCells == null)
                                {
                                    resultCells = new GridSearchResultCellCollection(this.SearchResultsGroupSize);
                                }
                                resultCells.Add(resultCell);
                                if (resultCells.Count == this.SearchResultsGroupSize)
                                {
                                    this.ReportSearchProgress(0, (GridSearchResultCellInfo)null, resultCells);
                                    resultCells = (GridSearchResultCellCollection)null;
                                }
                            }
                        }
                    }
                    else
                    {
                        GridViewRowInfo current2             = enumerator.Current as GridViewRowInfo;
                        int             traverserColumnIndex = -1;
                        for (int index = 0; index < current2.ViewTemplate.Columns.Count; ++index)
                        {
                            GridViewColumn column = (GridViewColumn)current2.ViewTemplate.Columns[index];
                            ++traverserColumnIndex;
                            if (GridViewSearchRowInfo.Cancel && !this.IsSearchAsync)
                            {
                                GridViewSearchRowInfo.Cancel = false;
                                e.Result = (object)true;
                                return;
                            }
                            GridViewDataColumn gridViewDataColumn = column as GridViewDataColumn;
                            if ((gridViewDataColumn == null || gridViewDataColumn.AllowSearching) && (column.IsVisible && !column.IsGrouped) && (!(column is GridViewImageColumn) && this.MatchesSearchCriteria(this.searchCriteria, current2, column)))
                            {
                                if (current2.SearchCache.ContainsKey((object)column))
                                {
                                    current2.SearchCache[(object)column] = (object)this.searchCriteria;
                                }
                                else
                                {
                                    current2.SearchCache.Add((object)column, (object)this.searchCriteria);
                                }
                                GridSearchResultCellInfo resultCell = new GridSearchResultCellInfo(current2, column, traverserRowIndex, traverserColumnIndex);
                                if (this.searchResult.Count < this.InitialSearchResultsTreshold)
                                {
                                    this.ReportSearchProgress(0, resultCell, (GridSearchResultCellCollection)null);
                                }
                                else
                                {
                                    if (resultCells == null)
                                    {
                                        resultCells = new GridSearchResultCellCollection();
                                    }
                                    resultCells.Add(resultCell);
                                    if (resultCells.Count == this.SearchResultsGroupSize)
                                    {
                                        this.ReportSearchProgress(0, (GridSearchResultCellInfo)null, resultCells);
                                        resultCells = (GridSearchResultCellCollection)null;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (resultCells != null && resultCells.Count > 0)
            {
                this.ReportSearchProgress(100, (GridSearchResultCellInfo)null, resultCells);
            }
            else
            {
                this.ReportSearchProgress(100, (GridSearchResultCellInfo)null, (GridSearchResultCellCollection)null);
            }
        }