2012-02-17 05:09:27 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2012-04-24 10:49:27 -03:00
|
|
|
|
namespace ArdupilotMega.Controls
|
2012-02-17 05:09:27 -04:00
|
|
|
|
{
|
2012-04-24 10:49:27 -03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Mono handles calls from other thread difrently - this prevents those crashs
|
|
|
|
|
/// </summary>
|
2012-02-17 05:09:27 -04:00
|
|
|
|
class myGMAP : GMap.NET.WindowsForms.GMapControl
|
|
|
|
|
{
|
2012-02-20 07:30:47 -04:00
|
|
|
|
public bool inOnPaint = false;
|
|
|
|
|
string otherthread = "";
|
2012-09-19 20:37:36 -03:00
|
|
|
|
int lastx = 0;
|
|
|
|
|
int lasty = 0;
|
|
|
|
|
|
|
|
|
|
public myGMAP()
|
|
|
|
|
: base()
|
|
|
|
|
{
|
|
|
|
|
this.Text = "Map";
|
|
|
|
|
}
|
2012-02-17 05:09:27 -04:00
|
|
|
|
|
|
|
|
|
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (inOnPaint)
|
|
|
|
|
{
|
2012-02-20 07:30:47 -04:00
|
|
|
|
Console.WriteLine("Was in onpaint Gmap th:" + System.Threading.Thread.CurrentThread.Name + " in " + otherthread);
|
2012-02-17 05:09:27 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
2012-02-20 07:30:47 -04:00
|
|
|
|
|
|
|
|
|
otherthread = System.Threading.Thread.CurrentThread.Name;
|
|
|
|
|
|
2012-02-17 05:09:27 -04:00
|
|
|
|
inOnPaint = true;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
base.OnPaint(e);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
|
|
|
|
|
|
|
|
|
|
inOnPaint = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2012-09-19 20:37:36 -03:00
|
|
|
|
if (e.X == lastx && e.Y == lasty)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
lastx = e.X;
|
|
|
|
|
lasty = e.Y;
|
|
|
|
|
|
2012-02-17 05:09:27 -04:00
|
|
|
|
base.OnMouseMove(e);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|