private void updateLine(TransitLine updateLine, System.Collections.IList newArrivals) { var lineToUpdate = Lines.Single(line => line.Equals(updateLine)); foreach (var newArrival in newArrivals) { var arrival = DateTime.Parse(newArrival.ToString()); lineToUpdate.Arrivals.Add(new ArrivalViewModel() { ArrivalTime = arrival.ToString("h:mm"), WhenINeedToLeave = (arrival - DateTime.Now - updateLine.WalkTime + TimeSpan.FromSeconds(1)).Minutes.ToString() + " min", } ); } }
private void Arrivals_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e, TransitLine line) { updateLine(line, e.NewItems); }