Example #1
0
        public override void Dispose()
        {
            if (Pen != null)
            {
                Pen.Dispose();
                Pen = null;
            }

            if (InnerMarker != null)
            {
                InnerMarker.Dispose();
                InnerMarker = null;
            }

            base.Dispose();
        }
Example #2
0
        private void MapTraceroute(string domain)
        {
            ThreadHelper.SetGmapZoom(this, gmapcontrol, 2);
            GMap.NET.WindowsForms.GMapOverlay markers = new GMap.NET.WindowsForms.GMapOverlay("markers");
            GMapOverlay        routes = new GMapOverlay("routes");
            List <PointLatLng> points = new List <PointLatLng>();

            ThreadHelper.SetText(this, trace_status_label, "tracing");


            trace_status_label.BackColor = Color.Yellow;
            var trace = tracert.GetTraceRoute(tracert_Textbox.Text);

            ThreadHelper.SetText(this, trace_status_label, "done...mapping points");
            foreach (var element in trace)
            {
                double lattitude;
                double longitude;

                var ipdetails = tracert.IPGEOINFO(element);
                if (ipdetails[0] == null)
                {
                    continue;
                }
                else
                {
                    lattitude = Convert.ToDouble(ipdetails[0].ToString());
                    longitude = Convert.ToDouble(ipdetails[1].ToString());

                    string coordinates = (ipdetails[0].ToString()) + (",") + (ipdetails[1].ToString());


                    GMap.NET.WindowsForms.GMapMarker marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new GMap.NET.PointLatLng(lattitude, longitude), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin);
                    marker.Dispose();
                    marker.ToolTipText         = ("Loc: " + coordinates + "\n" + ipdetails[2] + "\n" + ipdetails[3] + "\n" + ipdetails[4]);
                    marker.ToolTip.Fill        = Brushes.Black;
                    marker.ToolTip.Foreground  = Brushes.White;
                    marker.ToolTip.Stroke      = Pens.Black;
                    marker.ToolTip.TextPadding = new Size(20, 20);

                    points.Add(new PointLatLng(lattitude, longitude));

                    markers.Markers.Add(marker);
                    gmapcontrol.Overlays.Clear();
                    gmapcontrol.Overlays.Add(markers);
                }
            }
            try
            {
                GMapRoute route = new GMapRoute(points, "test");
                routes.Routes.Add(route);
                ThreadHelper.SetText(this, trace_status_label, "adding routes...");
                gmapcontrol.Overlays.Add(routes);
            }
            catch
            {
            }
            ThreadHelper.SetGmapZoom(this, gmapcontrol, 3);
            ThreadHelper.SetText(this, trace_status_label, "idle");
            trace_status_label.BackColor = Color.Silver;
        }