Geolocation

The Geolocation extension component adds geolocation capabilities to the container it is dropped on. Provides methods to retrieve the current location of the client and raises events when the location changes.

How to Use

The Geolocation extension can be added to a Wisej.NET project using NuGet Package Manager.

You can add a Geolocation component by dragging it from the toolbox into the designer.

Geolocation supports an ActiveWatch which fires a PositionChanged event when the location of the Device changes.

Depending on your device you can control the Geolocation component with EnableHighAccuracy and by defining a Timeout for detecting the position.

Retrieve the current position with GetCurrentPositionAsync.

// Get location and show location information in an AlertBox on button click
private async void button1_Click(object sender, EventArgs e)
	{
		var position = await this.geolocation1.GetCurrentPositionAsync();
		AlertBox.Show(position.ToJSON());
	}

The user may need to allow the browser to read the geolocation.

Last updated