1
Hello, I would like to know how to best display a route from the latitude and longitude that are in the database in a C# Windows Forms application. I’ve searched the web and I’ve managed to find something similar to what I need, https://social.msdn.microsoft.com/Forums/pt-BR/0e0b98ce-be58-4b8a-901d-8a05f9dd54f0/gerar-rotas-no-google-maps?forum=504 But I still can not understand much not. The code is getting as follows:
using System;
using System.Data;
using System.Windows.Forms;
using System.Diagnostics;
using Microsoft.Win32;
namespace GSD
{
public class Class1{
public Class1(){
}
public void AbreGoogleMaps(double _lat1, double _long1, double _lat2, double _long2)
{
string defaultBrowserPath = GetDefaultBrowserPath();
try
{
Process.Start(defaultBrowserPath, string.Format("http://maps.google.com/maps?saddr={0},{1}&daddr={2},{3}", _lat1, _long1, _lat2, _long2));
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
}
private static string GetDefaultBrowserPath()
{
string key = @"htmlfile\shell\open\command";
RegistryKey registryKey = Registry.ClassesRoot.OpenSubKey(key, false);
return ((string)registryKey.GetValue(null, null)).Split('"')[1];
}
}
}