public LocationRequiredFieldsDialog(Bing.Location location, LocationRequiredFields requiredFields, LocationResourceManager resourceManager) : base(resourceManager) { SetField.NotNull(out this.location, nameof(location), location); this.requiredFields = requiredFields; this.location.Address = this.location.Address ?? new Bing.Address(); }
private static bool AreEqual(Bing.Location x, Bing.Location y) { // Other attributes of a location such as its Confidence, BoundaryBox, etc // should not be considered as distinguishing factors. // On the other hand, attributes of a location that are shown to the users // are what distinguishes one location from another. return(x.GetFormattedAddress(",") == y.GetFormattedAddress(",")); }
public string GetLocationMapImageUrl(Bing.Location location, int?index = null) { if (location == null) { throw new ArgumentNullException(nameof(location)); } var point = location.Point; if (point == null) { throw new ArgumentNullException(nameof(point)); } int zoom = 15; if (location.BoundaryBox != null && location.BoundaryBox.Count >= 4) { LatLng center; CalculateMapView(location.BoundaryBox, 500, 280, 0, out center, out zoom); point.Coordinates = new List <double>() { center.Latitude, center.Longitude }; } string imageUrl = string.Format( CultureInfo.InvariantCulture, ImageUrlByPoint, point.Coordinates[0], point.Coordinates[1], zoom, apiKey); return(GetMapImage(imageUrl, index.ToString())); }
public async Task <bool> IsFavorite(ITurnContext context, Bing.Location location) { var favorites = await GetFavorites(context); return(favorites.Any(favoriteLocation => AreEqual(location, favoriteLocation.Location))); }
/// <summary> /// Initializes a new instance of the <see cref="LocationDialogResponse"/> class. /// </summary> /// <param name="location">The location.</param> /// <param name="message">The message.</param> public LocationDialogResponse(Bing.Location location = null, string message = null) { this.Location = location; this.Message = message; }
/// <summary> /// Initializes a new instance of the <see cref="LocationDialogResponse"/> class. /// </summary> /// <param name="location">The location.</param> /// <param name="message">The message.</param> /// <param name="confirmed">Whether the address has been confirmed by user.</param> public LocationDialogResponse(Bing.Location location = null, string message = null, bool confirmed = false) { this.Location = location; this.Message = message; this.Confirmed = confirmed; }