Exemple #1
0
        /// <summary>
        /// Searches the current facet for locations according to an input text
        /// </summary>
        /// <param name="nodes">The TreeNodeCollection representing the category nodes of a facet</param>
        /// <param name="text">The text to search for in the location names</param>
        /// <returns>A SearchResults object</returns>
        public static SearchResults Search( TreeNodeCollection nodes, string text )
        {
            text = text.ToLower();
            SearchResults results = new SearchResults();

            foreach ( TreeNode cat in nodes )
            {
                foreach ( TreeNode sub in cat.Nodes )
                {
                    // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
                    foreach ( Location loc in sub.Tag as List<object> )
                    // Issue 10 - End
                    {
                        if ( loc.Name.ToLower().IndexOf( text ) != -1 )
                        {
                            // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
                            Result res = new Result( sub, ( sub.Tag as List<object> ).IndexOf( loc ) );
                            // Issue 10 - End
                            results.Add( res );
                        }
                    }
                }
            }

            return results;
        }
 /// <summary>
 /// Merges the results provided by a second search results
 /// </summary>
 /// <param name="moreResults"></param>
 public void MergeWith( SearchResults moreResults )
 {
     this.m_Results.AddRange( moreResults.m_Results );
 }