public static (string, List <Picture>) Buscar(string Search) { string[] ASearchs = Search.Split(' '); List <string> searchs = new List <string>(); foreach (string s in ASearchs) { searchs.Add(s); } int c = 0; List <Picture> search; PictureList temporalpiclist = new PictureList(); List <string> notFound = new List <string>(); notFound.Add("Resultados no encontrados"); foreach (string lb in searchs) { if (c == 0) { search = StaticAlbum.Search(lb); if (search.Count == 0) { notFound.Add(lb); continue; } temporalpiclist.AddListOfPics(search); c++; } search = temporalpiclist.Search(lb); if (search.Count == 0) { notFound.Add(lb); continue; } temporalpiclist = new PictureList(); temporalpiclist.AddListOfPics(search); } search = temporalpiclist.Copy(); string Message = ""; foreach (string word in notFound) { Message += (word + " "); } if (notFound.Count() == 1) { Message = ""; } return(Message, search); }
private void SearchBtn_Click(object sender, EventArgs e) { lbSearchresulltListbox.Items.Clear(); string Search = txtbSearch.Text; string SearchMesage = Busqueda.Buscar(Search).Item1; List <Picture> SearchResult = Busqueda.Buscar(Search).Item2; PictureList Results = new PictureList(); Results.AddListOfPics(SearchResult); foreach (string name in Results.ShowNames()) { lbSearchresulltListbox.Items.Add(name); } if (SearchMesage != "") { MessageBox.Show(SearchMesage); } }