public MainPage()

in TrafficApp/MainPage.xaml.cs [106:128]


        public MainPage()
        {
            this.InitializeComponent();

            this.Locations = new ObservableCollection<LocationData>();
            this.MappedLocations = new ObservableCollection<LocationData>(this.Locations);

            // MappedLocations is a superset of Locations, so any changes in Locations
            // need to be reflected in MappedLocations. 
            this.Locations.CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null) foreach (LocationData item in e.NewItems) this.MappedLocations.Add(item);
                if (e.OldItems != null) foreach (LocationData item in e.OldItems) this.MappedLocations.Remove(item);
            };

            // Update the travel times every 5 minutes.
            Helpers.StartTimer(5, async () => await this.UpdateLocationsTravelInfoAsync());

            // Update the freshness timestamp every minute;
            Helpers.StartTimer(1, () => { foreach (var location in this.Locations) location.RefreshFormattedTimestamp(); });

            LocationHelper.RegisterTrafficMonitor();
        }