protected async Task UpdateDictionary() { if (addressQueue.Count == 0) { return; } Console.WriteLine(addressQueue.Count + " houses to be retrieved"); //string[] s = new string[25]; //addressQueue.Values.CopyTo(s, 0); List <string> addressList = new List <string>();// s.ToList(); for (int a = 0; a < addressQueue.Count; a++) { addressList.Add(addressQueue.Values.ElementAt(a)); } for (int i = 0; i < addressList.Count; i++) { Console.WriteLine(i + ") " + addressList[i]); } List <double[]> coordinates = await MappingService.GetLocationsWithRouteTask(addressList); transactions++; if (coordinates == null) { return; } for (int i = 0; i < coordinates.Count; i++) { if (addressQueue.Count < i) { return; } if (coordinates[i] == null || addressQueue.Keys.ElementAt(i) == null) { return; } addressCoordinatesDictionary.Add(addressQueue.Keys.ElementAt(i), coordinates[i]); Console.WriteLine("Added " + addressQueue.Keys.ElementAt(i) + " [" + coordinates[i][0] + " " + coordinates[i][1] + "] to dictionary"); } addressQueue.Clear(); }