private static void ServidorLocalizacion() { AutoResetEvent e = new AutoResetEvent(false); LocalizacionGPS.StartServer(); e.WaitOne(); }
//#################################### //### Código para Localización GPS ### //#################################### //private void btnLocalizar_Click(object sender, EventArgs e) //{ // if (listCarros.SelectedItems.Count!=0) // { // //### Barra de Estado // this.Cursor = Cursors.WaitCursor; // toolStripProgressBar1.Style = ProgressBarStyle.Marquee; // toolStripStatusLabel1.Text = "Localizando..."; // //### Obtiene Coordenadas y Label de Cada Carro // try // { // LocalizacionGPS lgps = LocalizacionGPS.StartClient(); // Localizacion l1=Localizacion.FromString(lgps.Localizar_s(1)); // List<PointD> points = new List<PointD>(); // List<string> labels = new List<string>(); // for (int i = 0; i < listCarros.SelectedItems.Count; i++) // { // Localizacion l = Localizacion.FromString(lgps.Localizar_s((int)((DataRowView)listCarros.SelectedItems[i])["id_carro"])); // PointD p = new PointD(l.Longitud, l.Latitud); // p = Data.Util.TransformCoord(p);//new PointD(346145.539, 6288689.478); // points.Add(p); // labels.Add((string)((DataRowView)listCarros.SelectedItems[i])["nombre"]); // } // //### Dibujar Cada Carro // PlugData.ZoomToPointsPaint(points.ToArray(), labels.ToArray()); // } // catch (Exception ex) // { // Log.ShowAndLog(ex); // } // //### Terminar la Barra de Estado // this.Cursor = Cursors.Default; // toolStripProgressBar1.Style = ProgressBarStyle.Blocks; // toolStripStatusLabel1.Text = ""; // } // else // { // MessageBox.Show("Debe seleccionar carros para localizarlos.", "Sistema ZEUS"); // } //} private void btnLocalizar_Click(object sender, EventArgs e) { if (listCarros.SelectedItems.Count != 0) { //### Barra de Estado this.Cursor = Cursors.WaitCursor; toolStripProgressBar1.Style = ProgressBarStyle.Marquee; toolStripStatusLabel1.Text = "Localizando..."; //### Obtiene Coordenadas y Label de Cada Carro try { LocalizacionGPS lgps = LocalizacionGPS.StartClient(); Localizacion l1 = Localizacion.FromString(lgps.Localizar_s(1)); List <PointD> points = new List <PointD>(); List <string> labels = new List <string>(); for (int i = 0; i < listCarros.SelectedItems.Count; i++) { Localizacion l = Localizacion.FromString(lgps.Localizar_s((int)((DataRowView)listCarros.SelectedItems[i])["id_carro"])); PointD p = new PointD(l.Longitud, l.Latitud); //### LatLong 2 UTM //p = Data.Util.TransformCoord(p);//new PointD(346145.539, 6288689.478); points.Add(p); labels.Add((string)((DataRowView)listCarros.SelectedItems[i])["nombre"]); } //### Dibujar Cada Carro PlugData.ZoomToPointsPaint(points.ToArray(), labels.ToArray()); } catch (Exception ex) { Log.ShowAndLog(ex); } //### Terminar la Barra de Estado this.Cursor = Cursors.Default; toolStripProgressBar1.Style = ProgressBarStyle.Blocks; toolStripStatusLabel1.Text = ""; } else { MessageBox.Show("Debe seleccionar carros para localizarlos.", "Sistema ZEUS"); } }