다음을 통해 공유


GeoCoordinateWatcher.Status 속성

정의

GeoCoordinateWatcher의 현재 상태를 가져옵니다.

public:
 property System::Device::Location::GeoPositionStatus Status { System::Device::Location::GeoPositionStatus get(); };
public System.Device.Location.GeoPositionStatus Status { get; }
member this.Status : System.Device.Location.GeoPositionStatus
Public ReadOnly Property Status As GeoPositionStatus

속성 값

GeoPositionStatus의 데이터를 사용할 수 있는지 여부를 나타내는 GeoCoordinateWatcher입니다.

구현

예제

다음 예제에서는 핸들 StatusChanged 이벤트 및 메시지 기반 인쇄는 Status합니다.

using System;
using System.Device.Location;
namespace ShowStatusUpdates
{
    class Program
    {
        static void Main(string[] args)
        {
            ShowStatusUpdates();
        }

        static void ShowStatusUpdates()
        {
            GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
            watcher.Start();

            watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);

            Console.WriteLine("Enter any key to quit.");
            Console.ReadLine();
        }

        static void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
        {
            switch (e.Status)
            {
                case GeoPositionStatus.Initializing:
                    Console.WriteLine("Working on location fix");
                    break;

                case GeoPositionStatus.Ready:
                    Console.WriteLine("Have location");
                    break;

                case GeoPositionStatus.NoData:
                    Console.WriteLine("No data");
                    break;

                case GeoPositionStatus.Disabled:
                    Console.WriteLine("Disabled");
                    break;
            }
        }
    }
}
Imports System.Device.Location

Module GetLocationEvent

    Sub ShowStatusUpdates()
        Dim Watcher As GeoCoordinateWatcher
        Watcher = New GeoCoordinateWatcher()
        watcher.Start()
        AddHandler Watcher.StatusChanged, AddressOf watcher_StatusChanged

        Console.WriteLine("Enter any key to quit.")
        Console.ReadLine()
    End Sub

    Sub watcher_StatusChanged(ByVal sender As Object, ByVal e As GeoPositionStatusChangedEventArgs)
        Select Case e.Status
            Case GeoPositionStatus.Initializing
                Console.WriteLine("Working on location fix")
            Case GeoPositionStatus.Ready
                Console.WriteLine("Have location")
            Case GeoPositionStatus.NoData
                Console.WriteLine("No data")
            Case GeoPositionStatus.Disabled
                Console.WriteLine("Disabled")
        End Select
    End Sub

    Public Sub Main()
        ShowStatusUpdates()
    End Sub
End Module

적용 대상

추가 정보