Back to Devexpress

LocationInformationReceivedEventArgs Class

wpf-devexpress-dot-xpf-dot-map-a1fa82fa.md

latest5.0 KB
Original Source

LocationInformationReceivedEventArgs Class

Provides data for the BingGeocodeDataProvider.LocationInformationReceived event.

Namespace : DevExpress.Xpf.Map

Assembly : DevExpress.Xpf.Map.v25.2.dll

NuGet Package : DevExpress.Wpf.Map

Declaration

csharp
public class LocationInformationReceivedEventArgs :
    AsyncCompletedEventArgs
vb
Public Class LocationInformationReceivedEventArgs
    Inherits AsyncCompletedEventArgs

LocationInformationReceivedEventArgs is the data class for the following events:

Remarks

An instance of the LocationInformationReceivedEventArgs class with appropriate settings is automatically created and passed to the corresponding event’s handler.

Example

xaml
<dxm:AzureGeocodeDataProvider x:Name="geocodeProvider" ProcessMouseEvents="False"
    AzureKey="{Binding Source={StaticResource YourAzureKey}}" 
    LocationInformationReceived="geocodeProvider_LocationInformationReceived"/>
csharp
private void geocodeProvider_LocationInformationReceived(object sender, LocationInformationReceivedEventArgs e) {
    GeocodeRequestResult result = e.Result;
    StringBuilder resultList = new StringBuilder("");
    resultList.Append(String.Format("Status: {0}\n", result.ResultCode));
    resultList.Append(String.Format("Fault reason: {0}\n", result.FaultReason));
    resultList.Append(String.Format(" ______________________________ \n"));

    if (result.ResultCode != RequestResultCode.Success) {
        tbResults.Text = resultList.ToString();
        return; 
    }

    int resCounter = 1;
    foreach (LocationInformation locations in result.Locations) {
        resultList.Append(String.Format("Request Result {0}:\n", resCounter));
        resultList.Append(String.Format("Display Name: {0}\n", locations.DisplayName));
        resultList.Append(String.Format("Entity Type: {0}\n", locations.EntityType));
        resultList.Append(String.Format("Address: {0}\n", locations.Address));
        resultList.Append(String.Format("Location: {0}\n", locations.Location));
        resultList.Append(String.Format(" ______________________________ \n"));
        resCounter++;
    }

    tbResults.Text = resultList.ToString();
}
vb
Private Sub geocodeProvider_LocationInformationReceived(ByVal sender As Object, ByVal e As LocationInformationReceivedEventArgs)
    Dim result As GeocodeRequestResult = e.Result
    Dim resultList As New StringBuilder("")
    resultList.Append(String.Format("Status: {0}" & ControlChars.Lf, result.ResultCode))
    resultList.Append(String.Format("Fault reason: {0}" & ControlChars.Lf, result.FaultReason))
    resultList.Append(String.Format(" ______________________________" & ControlChars.Lf))

    If result.ResultCode <> RequestResultCode.Success Then
        tbResults.Text = resultList.ToString()
        Return
    End If

    Dim resCounter As Integer = 1
    For Each locations As LocationInformation In result.Locations
        resultList.Append(String.Format("Request Result {0}:" & ControlChars.Lf, resCounter))
        resultList.Append(String.Format("Display Name: {0}" & ControlChars.Lf, locations.DisplayName))
        resultList.Append(String.Format("Entity Type: {0}" & ControlChars.Lf, locations.EntityType))
        resultList.Append(String.Format("Address: {0}" & ControlChars.Lf, locations.Address))
        resultList.Append(String.Format("Location: {0}" & ControlChars.Lf, locations.Location))
        resultList.Append(String.Format(" ______________________________" & ControlChars.Lf))
        resCounter += 1
    Next locations

    tbResults.Text = resultList.ToString()
End Sub

Inheritance

Object EventArgs AsyncCompletedEventArgs LocationInformationReceivedEventArgs

See Also

LocationInformationReceivedEventArgs Members

DevExpress.Xpf.Map Namespace