コード例 #1
0
 private void FindItemFromDataSource(Product p, string searchBuffer, ref List<int> list)
 {
     Search(p, searchBuffer, ref list);
 }
コード例 #2
0
        /// <summary>
        /// Search text from items.
        /// </summary>
        /// <param name="p"></param>
        /// <param name="searchBuffer"></param>
        /// <param name="isValidate"></param>
        /// <returns></returns>
        private void Search(Product p, string searchBuffer, ref List<int> searchedIndexes)
        {
            if (p.ChildProducts == null)
            {
                return;
            }

            for (int index = 0; index < p.ChildProducts.Count; index++)
            {
                if (p.ChildProducts[index].Name.StartsWith(searchBuffer, StringComparison.InvariantCultureIgnoreCase))
                {
                    _isSearched = true;
                    searchedIndexes.Add(index);
                    break;
                }
                else
                {
                    Search(p.ChildProducts[index], searchBuffer, ref searchedIndexes);
                    if (_isSearched)
                    {
                        searchedIndexes.Add(index);
                        break;
                    }
                }
            }
        }