void ParseOnlinePilots(string httpRes) { var xml = XDocument.Parse(httpRes); { XElement root = xml.Root; List <Pilot> pilots = new List <Pilot>(); foreach (XElement pilot in root.Elements("pilot")) { Pilot entry = new Pilot(pilot); pilots.Add(entry); } PilotList list = new PilotList(); list.List = pilots.ToArray(); _savedInstance = list; } RunOnUiThread(() => { PopulatePilotLists(_savedInstance); }); }
public StationInventory(XElement xml) { Int64 id; XAttribute idAttribute = xml.Attribute("id"); if (Int64.TryParse(idAttribute.Value, out id) == false) { throw new ArgumentException("Station ID not valid", "xml['id']"); } this.StationID = id; this.Name = xml.Attribute("name").Value; this.Faction = Pilot.FromString(xml.Attribute("faction").Value); this.Inventory = new List <InventoryItem>(); var items = xml.Elements("item"); foreach (XElement item in items) { InventoryItem entry = new InventoryItem(item); this.Inventory.Add(entry); } }
void ParseOnlinePilots(string httpRes) { var xml = XDocument.Parse(httpRes); { XElement root = xml.Root; List<Pilot> pilots = new List<Pilot>(); foreach (XElement pilot in root.Elements("pilot")) { Pilot entry = new Pilot(pilot); pilots.Add(entry); } PilotList list = new PilotList(); list.List = pilots.ToArray(); _savedInstance = list; } RunOnUiThread(() => { PopulatePilotLists(_savedInstance); }); }