Example #1
0
		private static void DoNode( TreeNode node, SearchResults results, string text )
		{
			foreach ( TreeNode subNode in node.Nodes )
			{
				DoNode( subNode, results, text );
			}
			// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
			if ( node.Tag != null && node.Tag is List<object> )
			{
				List<object> list = node.Tag as List<object>;
				// Issue 10 - End

				for ( int i = 0; i < list.Count; i++ )
				{
					object o = list[ i ];

					if ( o is BoxMobile )
					{
						BoxMobile mob = o as BoxMobile;

						if ( mob.Name.ToLower().IndexOf( text.ToLower() ) > -1 )
						{
							Result res = new Result( node, i );
							results.Add( res );
						}
					}
					else if ( o is BoxItem )
					{
						BoxItem item = o as BoxItem;

						if ( item.Name.ToLower().IndexOf( text.ToLower() ) > -1 )
						{
							Result res = new Result( node, i );
							results.Add( res );
						}
					}
				}
			}
		}
Example #2
0
		/// <summary>
		/// Searches for a given item
		/// </summary>
		/// <param name="text">Part of the name of the item</param>
		private void SearchFor( string text )
		{
			text = text.ToLower();

			m_Results = new SearchResults();

			foreach ( TreeNode cat in tCat.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 ( BoxDeco deco in sub.Tag as List<object> )
					{
						if ( deco.Name.ToLower().IndexOf( text ) > -1 )
						{
							// Result
							Result r = new Result( sub, ( sub.Tag as List<object> ).IndexOf( deco ) );
							// Issue 10 - End
							m_Results.Add( r );
						}
					}
				}
			}

			if ( m_Results.Count > 0 )
			{
				ShowNextResult();
			}
			else
			{
				MessageBox.Show( Pandora.Localization.TextProvider[ "Deco.NoResults" ] );
			}
		}
Example #3
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;
		}