public void SetVehiclePosition(double Latitude, double Longitude, Map ActiveMap, string Name, string Descrizione, string ID, string IconPath,bool Clear) { Symbol VehicleSymbols = null; // string SymbolPath; // int SymbolID; Symbol NullSymbols = null; Location Position; Pushpin vehicle; if (Clear) { if (ActiveMap != null) { foreach (MapPoint.DataSet dataSet in ActiveMap.DataSets) { if (dataSet.RecordCount > 0 && (dataSet.DataMapType == MapPoint.GeoDataMapType.geoDataMapTypePushpin || dataSet.DataMapType == MapPoint.GeoDataMapType.geoDataMapTypeTerritory)) { dataSet.Delete(); } } if(Mode==1) FLOTTA = frmMapPoint.Map.ActiveMap.DataSets.AddPushpinSet("FLOTTA"); } } string path = AppDomain.CurrentDomain.BaseDirectory; try { if (File.Exists(IconPath)) VehicleSymbols = ActiveMap.Symbols.Add(IconPath); } catch { VehicleSymbols = ActiveMap.Symbols.ItemByID(0); } if (File.Exists(@path + "white.bmp")) NullSymbols = ActiveMap.Symbols.Add(@path + "white.bmp"); Position = ActiveMap.GetLocation(Latitude, Longitude, ActiveMap.Altitude); vehicle = ActiveMap.AddPushpin(Position, Name); if(FLOTTA!=null && Mode==1) vehicle.MoveTo(FLOTTA); //vehicle.Symbol = (short)(ActiveMap.Symbols.Count-1); if(VehicleSymbols!=null) vehicle.Symbol = VehicleSymbols.ID; vehicle.Note = Descrizione; vehicle.BalloonState = GeoBalloonState.geoDisplayBalloon; if(Mode != 1) ActiveMap.GoToLatLong(Latitude, Longitude, ActiveMap.Altitude); }