void MonitoreoProceso_Main(object sender, MonitoreoEventArgs e) { bool TramaVentaManguera = false; bool Levanta = false; string galones = ""; string dinero = ""; if (e.Texto == "LEVANTAMANGUERA") { TramaVentaManguera = true; Levanta = true; } if (e.Texto.StartsWith("BAJAMANGUERA")) { string[] arrayMensaje = UtilidadesTramas.ObtieneArrayTrama(e.Texto); if (arrayMensaje.Count() == 3) { galones = arrayMensaje[1]; dinero = arrayMensaje[2]; } TramaVentaManguera = true; Levanta = false; } if (TramaVentaManguera == true) { if (this.InvokeRequired == true) { LevantaBajaMangueraEvent d = new LevantaBajaMangueraEvent(LevantaoBajaManguera); this.Invoke(d, e.Cara, e.IdXbee, Levanta, galones, dinero); } else { LevantaoBajaManguera(e.Cara, e.IdXbee, Levanta, galones, dinero); } return; } LogPantalla newLog = new LogPantalla(); newLog.Mensaje = e.Texto; newLog.Fecha = DateTime.Now; newLog.Dispositivo = e.Dispositivo; if (this.SFGridLog.InvokeRequired == true) { AsignarRegistrosRejilla d = new AsignarRegistrosRejilla(RefrescarRejilla); this.Invoke(d, newLog); } else { RefrescarRejilla(newLog); } }
void RefrescarRejilla(LogPantalla _log) { if (dtLog == null) { dtLog = new DataTable(); dtLog.Columns.Add("Fecha", typeof(DateTime)); dtLog.Columns.Add("Mensaje", typeof(string)); dtLog.Columns.Add("Dispositivo", typeof(string)); } else { if (dtLog.Rows.Count > 600) { dtLog.Rows.Clear(); } } DataRow NewRow = dtLog.NewRow(); NewRow["Fecha"] = _log.Fecha; NewRow["Mensaje"] = _log.Mensaje; NewRow["Dispositivo"] = _log.Dispositivo; dtLog.Rows.Add(NewRow); if (bindingSource == null) { bindingSource = new BindingSource(); bindingSource.DataSource = dtLog; bindingSource.Sort = "Fecha Desc"; this.SFGridLog.DataSource = bindingSource; } else { bindingSource.ResetBindings(false); if (this.SFGridLog.Rows.Count > 0) { this.SFGridLog.Rows[0].Selected = true; this.SFGridLog.CurrentCell = this.SFGridLog.Rows[0].Cells[0]; } } }
void MonitoreoProceso_Main(object sender, MonitoreoEventArgs e) { //if (ListadoLog == null) //{ // ListadoLog = new List<LogPantalla>(); //} LogPantalla newLog = new LogPantalla(); newLog.Mensaje = e.Texto; newLog.Fecha = DateTime.Now; ListadoLog.Add(newLog); if (this.gcRejilla.InvokeRequired == true) { AsignarRegistrosRejilla d = new AsignarRegistrosRejilla(RefrescarRejilla); this.Invoke(d, new object[] { }); } else { RefrescarRejilla(); } }
void RefrescarRejilla(LogPantalla _log) { if (dtLog == null) { dtLog = new DataTable(); dtLog.Columns.Add("Fecha", typeof(DateTime)); dtLog.Columns.Add("Mensaje", typeof(string)); dtLog.Columns.Add("Dispositivo", typeof(string)); } else { if (dtLog.Rows.Count > 600) { dtLog.Rows.Clear(); } } DataRow NewRow = dtLog.NewRow(); NewRow["Fecha"] = _log.Fecha; NewRow["Mensaje"] = _log.Mensaje; NewRow["Dispositivo"] = _log.Dispositivo; dtLog.Rows.Add(NewRow); if(bindingSource == null) { bindingSource = new BindingSource(); bindingSource.DataSource = dtLog; bindingSource.Sort = "Fecha Desc"; this.SFGridLog.DataSource = bindingSource; } else { bindingSource.ResetBindings(false); if (this.SFGridLog.Rows.Count > 0) { this.SFGridLog.Rows[0].Selected = true; this.SFGridLog.CurrentCell = this.SFGridLog.Rows[0].Cells[0]; } } }
void MonitoreoProceso_Main(object sender, MonitoreoEventArgs e) { bool TramaVentaManguera = false; bool Levanta = false; string galones = ""; string dinero = ""; if (e.Texto == "LEVANTAMANGUERA") { TramaVentaManguera = true; Levanta = true; } if (e.Texto.StartsWith("BAJAMANGUERA")) { string[] arrayMensaje = UtilidadesTramas.ObtieneArrayTrama(e.Texto); if (arrayMensaje.Count() == 3) { galones = arrayMensaje[1]; dinero = arrayMensaje[2]; } TramaVentaManguera = true; Levanta = false; } if (TramaVentaManguera == true) { if (this.InvokeRequired == true) { LevantaBajaMangueraEvent d = new LevantaBajaMangueraEvent(LevantaoBajaManguera); this.Invoke(d, e.Cara, e.IdXbee, Levanta, galones, dinero); } else { LevantaoBajaManguera(e.Cara, e.IdXbee, Levanta,galones,dinero); } return; } LogPantalla newLog = new LogPantalla(); newLog.Mensaje = e.Texto; newLog.Fecha = DateTime.Now; newLog.Dispositivo = e.Dispositivo; if (this.SFGridLog.InvokeRequired == true) { AsignarRegistrosRejilla d = new AsignarRegistrosRejilla(RefrescarRejilla); this.Invoke(d, newLog); } else { RefrescarRejilla(newLog); } }