private Boolean moreExist(Tag t) { XDocument doc = System.Xml.Linq.XDocument.Load("movies.xml"); foreach (XElement element in doc.Element("movielist").Elements()) { if(element.Element(t.Type).Value.Equals(t.Text) && element.Element("owned").Value.Equals("false")) { return true; } } return false; }
private void populateSuggestions(Tag t,FlowLayoutPanel flow) { XDocument doc = System.Xml.Linq.XDocument.Load("movies.xml"); List<Movie> movies = new List<Movie>(); int j = 0; foreach (XElement element in doc.Element("movielist").Elements()) { if (j == 10) { break; } else if (element.Element(t.Type).Value.Equals(t.Text)) { movies.Add(new Movie(element)); j++; } } foreach (Movie movie in movies) { moviePanel p = new moviePanel(movie, 130, 140); p.Anchor = AnchorStyles.None; p.Dock = DockStyle.None; p.Margin = new Padding(20, 5, 0, 0); p.BorderStyle = BorderStyle.FixedSingle; flow.Controls.Add(p); } }
private string getOwnedMovie(Tag t) { Console.WriteLine(">>" + t.Text); var doc = System.Xml.Linq.XDocument.Load("movies.xml"); foreach (var element in doc.Element("movielist").Elements()) { if(element.Element(t.Type).Value.Equals(t.Text) && element.Element("owned").Value.Equals("true")) { return "\""+element.Element("title").Value+"\""; } } return ""; }