public partial class GetLocation : Form
{
delegate void DecodePositionEvent();
GeoPostion geoPosition;
public GetLocation()
{
InitializeComponent();
geoPosition = new GeoPostion();
}
private void DecodePosition()
{
try
{
if (geoPosition != null)
{
mapBrowser.Navigate(string.Format("https://maps.google.com/maps?q=" +
geoPosition.GeoLatitude + "," + geoPosition.GeoLongtitude));
}
}
catch(Exception error)
{
MessageBox.Show(error.Message, "Error Loading Map.");
}
}
private void GetLocation_Load(object sender, EventArgs e)
{
try
{
GeoPostion.GetGeoPositions();
computersCmBox.BindingContext = new BindingContext();
computersCmBox.DataSource = GeoPostion.AssetGeoPos;
computersCmBox.DisplayMember = "ComputerName";
computersCmBox.ValueMember = "Staff_ID";
}
catch (Exception err)
{
MessageBox.Show(err.Message, "Error Loading Geo-Position");
}
}
private void computersCmBox_SelectedIndexChanged(object sender, EventArgs e)
{
if(computersCmBox.SelectedIndex > 0)
{
geoPosition = GeoPostion.AssetGeoPos.Find(geo => geo.Staff_ID.Equals(computersCmBox.SelectedValue));
if(geoPosition != null)
{
if (Utilities.IsStringEmpty(geoPosition.ComputerName).Equals(false) & computersCmBox.SelectedValue.Equals(-1).Equals(false))
{
Utilities.AssignData(new string[] { geoPosition.GeoLatitude, geoPosition.GeoLongtitude, geoPosition.DateStamp + ": " + geoPosition.TimeStamp },
latitudeTxt, longtitudeTxt, timeStampTxt);
new DecodePositionEvent(DecodePosition).Invoke();
}
else
{
mapBrowser.Navigate("about:blank");
Utilities.ClearControl(latitudeTxt, longtitudeTxt, timeStampTxt);
}
}
}
}
private void closeBtn_Click(object sender, EventArgs e)
{
this.Hide();
this.Dispose();
}
}
}
The bolded line is the source of the problem because the error I get is below:
You seem to be using an unsupported browser.
Old browsers can put your security at risk, are slow and don't work with newer Google Maps features. To access Google Maps, you'll need to update to a modern browser.