static void client_getAreaStringCompleted(object sender, myTV.getAreaStringCompletedEventArgs e) { var list = e.Result.ToList(); var query = from p in XDocument.Load(@"c:\area.xml").Root.Elements("city") select p; if (query.Count() > 0) { initXML(@"c:\area.xml", "city"); } XDocument xml = XDocument.Load(@"c:\area.xml"); foreach (string str in list) { //wr.WriteLine(str); XElement area = new XElement("city", new XElement("id", str.Split('@')[0]), new XElement("name", str.Split('@')[1])); xml.Root.Add(area); } xml.Save(@"c:\area.xml"); }
static void client_getTVstationStringCompleted(object sender, myTV.getTVstationStringCompletedEventArgs e) { var list = e.Result.ToList(); }