We are having below package but I need to get location co-ordinates using wmi query is that possible

Issue

This Content is from Stack Overflow. Question asked by sai tharun

using System;
using System.Device.Location;

namespace GetLocationProperty
{
class Program
{
static void Main(string[] args)
{
GetLocationProperty();
}

    static void GetLocationProperty()
    {
        GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();

        // Do not suppress prompt, and wait 1000 milliseconds to start.
        watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));

        GeoCoordinate coord = watcher.Position.Location;

        if (coord.IsUnknown != true)
        {
            Console.WriteLine("Lat: {0}, Long: {1}",
                coord.Latitude,
                coord.Longitude);
        }
        else
        {
            Console.WriteLine("Unknown latitude and longitude.");
        }
    }
}

}



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?