Skip to content

Commit

Permalink
launch of GoogleEarth somehow doesn't work anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoerstemeier committed Aug 22, 2016
1 parent da132ce commit 15ec7cb
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions GeoCoordinateForm.cs
Expand Up @@ -3,14 +3,13 @@
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EARTHLib;
using De.AHoerstemeier.Geo;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
using System.IO;
using De.AHoerstemeier.Geo;

namespace De.AHoerstemeier.Tambon
{
Expand Down Expand Up @@ -124,7 +123,7 @@ private void SetValues(GeoPoint geoPoint, UtmPoint utmPoint, object sender)
try
{
var sheet = RtsdMapIndex.IndexL7018(geoPoint);
if (sheet != null)
if ( sheet != null )
{
lbl_L7018Value.Text = sheet.Name;
}
Expand Down Expand Up @@ -168,7 +167,7 @@ private void edit_UTM_TextChanged(object sender, EventArgs e)
{
if ( !_Changing )
{
String value = TambonHelper.ReplaceThaiNumerals(edt_UTM.Text.ToUpper()).Replace(",","").Trim();
String value = TambonHelper.ReplaceThaiNumerals(edt_UTM.Text.ToUpper()).Replace(",", "").Trim();
GeoPoint geoPoint = null;
UtmPoint utmPoint = null;
try
Expand Down Expand Up @@ -213,7 +212,6 @@ private void edt_geohash_TextChanged(object sender, EventArgs e)
SetValues(geoPoint, utmPoint, sender);
_Changing = false;
}

}

private void edt_LatLong_TextChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -244,24 +242,24 @@ private void edt_LatLong_TextChanged(object sender, EventArgs e)

private void btnFlyTo_Click(object sender, EventArgs e)
{
try
{
var googleEarth = new ApplicationGEClass();
//try
//{
// var googleEarth = new ApplicationGEClass();

String tempKmlFile = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".kml";
KmlHelper kmlWriter = new KmlHelper();
kmlWriter.AddPoint(_Point.Latitude, _Point.Longitude, "Temporary location", "", "", "");
kmlWriter.SaveToFile(tempKmlFile);
while ( googleEarth.IsInitialized() == 0 )
{
Thread.Sleep(500);
}
googleEarth.OpenKmlFile(tempKmlFile, 0);
}
catch ( Exception ex )
{
MessageBox.Show(ex.ToString());
}
// String tempKmlFile = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".kml";
// KmlHelper kmlWriter = new KmlHelper();
// kmlWriter.AddPoint(_Point.Latitude, _Point.Longitude, "Temporary location", "", "", "");
// kmlWriter.SaveToFile(tempKmlFile);
// while ( googleEarth.IsInitialized() == 0 )
// {
// Thread.Sleep(500);
// }
// googleEarth.OpenKmlFile(tempKmlFile, 0);
//}
//catch ( Exception ex )
//{
// MessageBox.Show(ex.ToString());
//}
}
}
}
}

0 comments on commit 15ec7cb

Please sign in to comment.