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); }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) { case 0: deviceCtrl1.Visible = true; grpVeicoli.Visible = false; grpStorico.Visible = false; Mode = 0; tmrFlotta.Enabled = false; if (FLOTTA != null){ FLOTTA.Delete(); } FLOTTA = null; break; case 1: deviceCtrl1.Visible = false; grpVeicoli.Visible = true; grpStorico.Visible = false; Mode = 0; //showFlotta(); //tmrFlotta.Enabled = true; break; case 2: deviceCtrl1.Visible = false; grpVeicoli.Visible = false; grpStorico.Visible = true; Mode = 2; dateFrom.Value = DateTime.Now.Subtract(TimeSpan.FromDays(1)); dateTo.Value = DateTime.Now; tmrFlotta.Enabled = false; grpStorico.Text = "Storico"; FLOTTA = null; if (FLOTTA != null){ FLOTTA.Delete(); } searchStorico(); break; } }