ICivicAddressResolver.ResolveAddressCompleted イベント
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ResolveAddressAsync(GeoCoordinate) を使用して緯度/経度を都市の住所に解決する非同期要求が完了すると発生します。
public:
event EventHandler<System::Device::Location::ResolveAddressCompletedEventArgs ^> ^ ResolveAddressCompleted;
event EventHandler<System.Device.Location.ResolveAddressCompletedEventArgs> ResolveAddressCompleted;
member this.ResolveAddressCompleted : EventHandler<System.Device.Location.ResolveAddressCompletedEventArgs>
Event ResolveAddressCompleted As EventHandler(Of ResolveAddressCompletedEventArgs)
イベントの種類
例
次の例では、 イベントを呼び出 ResolveAddressAsync して処理する方法を ResolveAddressCompleted 示します。
static void ResolveAddressAsync()
{
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
bool started = false;
watcher.MovementThreshold = 1.0; // set to one meter
started = watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));
if (started)
{
CivicAddressResolver resolver = new CivicAddressResolver();
resolver.ResolveAddressCompleted += new EventHandler<ResolveAddressCompletedEventArgs>(resolver_ResolveAddressCompleted);
if (watcher.Position.Location.IsUnknown == false)
{
resolver.ResolveAddressAsync(watcher.Position.Location);
}
}
}
static void resolver_ResolveAddressCompleted(object sender, ResolveAddressCompletedEventArgs e)
{
if (!e.Address.IsUnknown)
{
Console.WriteLine("Country: {0}, Zip: {1}",
e.Address.CountryRegion,
e.Address.PostalCode);
}
else
{
Console.WriteLine("Unknown address.");
}
}
Public Sub ResolveCivicAddressAsync()
Dim watcher As GeoCoordinateWatcher
watcher = New System.Device.Location.GeoCoordinateWatcher(GeoPositionAccuracy.High)
Dim started As Boolean = False
watcher.MovementThreshold = 1.0 'set to one meter
started = watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))
If started Then
Dim resolver As CivicAddressResolver = New CivicAddressResolver()
AddHandler resolver.ResolveAddressCompleted, AddressOf resolver_ResolveAddressCompleted
If Not watcher.Position.Location.IsUnknown Then
resolver.ResolveAddressAsync(watcher.Position.Location)
End If
End If
watcher.Start()
End Sub
Sub resolver_ResolveAddressCompleted(ByVal sender As Object, ByVal e As ResolveAddressCompletedEventArgs)
If Not e.Address.IsUnknown Then
Console.WriteLine("Country: {0}, Zip: {1}",
e.Address.CountryRegion,
e.Address.PostalCode)
Else
Console.WriteLine("Unknown address.")
End If
End Sub
適用対象
こちらもご覧ください
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET