public void GetBusInfo(BusInformation bus) { busInformation = bus; textViews[0].Text = busInformation.ID; textViews[1].Text = busInformation.Lat; textViews[2].Text = busInformation.Lon; textViews[3].Text = busInformation.SecsPassed + "Secs"; textViews[4].Text = busInformation.Heading; textViews[5].Text = busInformation.SpeedKmHr + "KmHr"; }
public void StartBusData() { busInfoList = new List <string>(); busData = new List <BusInformation>(); string newURL = URL + myAgencyTag + "&r=" + myRouteTag + "&t=1144953500233"; xmlReader = XmlReader.Create(newURL); count = 0; while (xmlReader.Read()) { if (xmlReader.HasAttributes) { if (xmlReader.Name == "vehicle") { BusInformation bus = new BusInformation(); for (int x = 0; x < xmlReader.AttributeCount; x++) { xmlReader.MoveToAttribute(x); switch (xmlReader.Name) { case "id": busInfoList.Add("Bus #" + (count + 1) + " ID: " + xmlReader.GetAttribute(x)); bus.ID = xmlReader.GetAttribute(x); break; case "lat": bus.Lat = xmlReader.GetAttribute(x); break; case "lon": bus.Lon = xmlReader.GetAttribute(x); break; case "secsSinceReport": bus.SecsPassed = xmlReader.GetAttribute(x); break; case "heading": bus.Heading = xmlReader.GetAttribute(x); break; case "speedKmHr": bus.SpeedKmHr = xmlReader.GetAttribute(x); break; } } busData.Add(bus); count++; } } } }