in CSharp/BotBuilderLocation/Dialogs/LocationDialogFactory.cs [44:114]
public IDialog<LocationDialogResponse> CreateDialog(BranchType branch, Location location = null, string locationName = null, bool skipDialogPrompt = false)
{
bool isFacebookChannel = StringComparer.OrdinalIgnoreCase.Equals(this.channelId, "facebook");
if (branch == BranchType.LocationRetriever)
{
if (this.options.HasFlag(LocationOptions.UseNativeControl) && isFacebookChannel)
{
return new FacebookNativeLocationRetrieverDialog(
this.prompt,
this.geoSpatialService,
this.options,
this.requiredFields,
this.resourceManager);
}
IGeoSpatialService geoService;
if (useAzureMaps)
{
geoService = new AzureMapsSpatialService(this.apiKey);
}
else
{
geoService = new BingGeoSpatialService(this.apiKey);
}
return new RichLocationRetrieverDialog(
prompt: this.prompt,
supportsKeyboard: isFacebookChannel,
cardBuilder: new LocationCardBuilder(this.apiKey, this.resourceManager),
geoSpatialService: geoService,
options: this.options,
requiredFields: this.requiredFields,
resourceManager: this.resourceManager,
skipPrompt: skipDialogPrompt);
}
else if (branch == BranchType.FavoriteLocationRetriever)
{
IGeoSpatialService geoService;
if (useAzureMaps) {
geoService = new AzureMapsSpatialService(this.apiKey);
}
else {
geoService = new BingGeoSpatialService(this.apiKey);
}
return new FavoriteLocationRetrieverDialog(
isFacebookChannel,
new FavoritesManager(),
this,
new LocationCardBuilder(this.apiKey, this.resourceManager),
geoService,
this.options,
this.requiredFields,
this.resourceManager);
}
else if (branch == BranchType.AddToFavorites)
{
return new AddFavoriteLocationDialog(new FavoritesManager(), location, this.resourceManager);
}
else if (branch == BranchType.EditFavoriteLocation)
{
return new EditFavoriteLocationDialog(this, new FavoritesManager(), locationName, location, this.resourceManager);
}
else
{
throw new ArgumentException("Invalid branch value.");
}
}