private async static Task <GoogleDistanceDTO> GetTravelInfo(LocationDTO start, LocationDTO end)
        {
            if (MemorizationDictionary.ContainsKey(start))
            {
                if (MemorizationDictionary[start].ContainsKey(end))
                {
                    Result = MemorizationDictionary[start][end];
                    return(MemorizationDictionary[start][end]);
                }
            }
            await JSRuntime.InvokeVoidAsync("getDistance", start, end);

            return(Result);
        }
 public static void SetResult(GoogleDistanceDTO result, LocationDTO start, LocationDTO end)
 {
     if (_segmentsCount % 2 == 0)
     {
         _lastResult = result;
     }
     else
     {
         if (result.distance.value > _lastResult.distance.value)
         {
             Result = result;
         }
         else
         {
             Result = _lastResult;
         }
         if (!MemorizationDictionary.ContainsKey(start))
         {
             MemorizationDictionary[start] = new Dictionary <LocationDTO, GoogleDistanceDTO>(new LocationDTOComparer());
         }
         MemorizationDictionary[start][end] = Result;
     }
     _segmentsCount++;
 }