public void BuildBox(ComboBox namebox, ComboBox sexbox, ComboBox breedbox, ComboBox agebox, ComboBox vacbox) { IStrategy p = new LinqToXML(); List <Cats> res = p.AnalyzeFile(new Cats(), path); List <string> name = new List <string>(); List <string> sex = new List <string>(); List <string> age = new List <string>(); List <string> breed = new List <string>(); List <string> vac = new List <string>(); foreach (Cats x in res) { if (!name.Contains(x.name)) { name.Add(x.name); } if (!sex.Contains(x.sex)) { sex.Add(x.sex); } if (!breed.Contains(x.breed)) { breed.Add(x.breed); } if (!age.Contains(x.age)) { age.Add(x.age); } if (!vac.Contains(x.vac)) { vac.Add(x.vac); } } name = name.OrderBy(x => x).ToList(); sex = sex.OrderBy(x => x).ToList(); breed = breed.OrderBy(x => x).ToList(); age = age.OrderBy(x => x).ToList(); vac = vac.OrderBy(x => x).ToList(); namebox.Items.AddRange(name.ToArray()); sexbox.Items.AddRange(sex.ToArray()); breedbox.Items.AddRange(breed.ToArray()); agebox.Items.AddRange(age.ToArray()); vacbox.Items.AddRange(vac.ToArray()); }
private void Parsing4XML() { Cats myTemp = OurSearch(); List <Cats> res; if (radioSAX.Checked) { IStrategy parser = new SAX(); res = parser.AnalyzeFile(myTemp, path); Output(res); } else if (radioDOM.Checked) { IStrategy parser = new DOM(); res = parser.AnalyzeFile(myTemp, path); Output(res); } else if (radioLINQ.Checked) { IStrategy parser = new LinqToXML(); res = parser.AnalyzeFile(myTemp, path); Output(res); } }