// Metodos private void StartHB() { // cargar config string server; string pipe; int interv; string id, format; bool useSerial; // Si se han cambiado los valores en los controles if (valuesChanged) { // leer valores de controles server = tbServer.Text; pipe = tbPipe.Text; interv = int.Parse(tbInterval.Text); id = tbID.Text; useSerial = chkSerial.Checked; format = tbFormat.Text; // actualizar config _dbRoot.Servidor = server; _dbRoot.Pipe = pipe; _dbRoot.Intervalo = interv; _dbRoot.Format = format; _dbRoot.ClientID = tbID.Text; _dbRoot.UseSerial = chkSerial.Checked; if (rbKeyId.Checked) { _dbRoot.UseId = true; } else { _dbRoot.UseId = false; } SaveDatabase(); valuesChanged = false; } else { // leer valores de DB server = _dbRoot.Servidor; pipe = _dbRoot.Pipe; interv = _dbRoot.Intervalo; format = _dbRoot.Format; id = _dbRoot.ClientID; useSerial = _dbRoot.UseSerial; if (_dbRoot.UseId) { rbKeyId.Checked = true; } else { rbKeyPort.Checked = true; } } if (!rbKeyId.Checked) { id = null; } HeartBeatGenerator hbgen = new HeartBeatGenerator { ClientID = id, UsarSerialHB = useSerial, TimestampFormat = format }; // _sender = new HeartbeatClient(server, pipe, 3, _enc, interv, hbgen); _sender.StartTimer(); }
// Metodos private void StartHB() { // cargar config string ipad; int remPort; int locPort; int interv; string id, format; bool useSerial; // Si se han cambiado los valores en los controles if (valuesChanged) { // leer valores de controles ipad = tbIp.Text; remPort = int.Parse(tbSPort.Text); locPort = int.Parse(tbLocalPort.Text); interv = int.Parse(tbInterval.Text); id = tbID.Text; useSerial = chkSerial.Checked; format = tbFormat.Text; // actualizar config _dbRoot.IpServidor = ipad; _dbRoot.PuertoServidor = remPort; _dbRoot.PuertoLocal = locPort; _dbRoot.Intervalo = interv; _dbRoot.Format = format; _dbRoot.ClientID = id; _dbRoot.UseSerial = useSerial; if (rbKeyId.Checked) { _dbRoot.UseId = true; } else { _dbRoot.UseId = false; } SaveDatabase(); valuesChanged = false; } else { // leer valores de DB ipad = _dbRoot.IpServidor; remPort = _dbRoot.PuertoServidor; locPort = _dbRoot.PuertoLocal; interv = _dbRoot.Intervalo; format = _dbRoot.Format; id = _dbRoot.ClientID; useSerial = _dbRoot.UseSerial; if (_dbRoot.UseId) { rbKeyId.Checked = true; } else { rbKeyPort.Checked = true; } } if (!rbKeyId.Checked) { id = null; } HeartBeatGenerator hbgen = new HeartBeatGenerator { ClientID = id, UsarSerialHB = useSerial }; _sender = new HeartbeatClient(ipad, remPort, locPort, _enc, interv, hbgen); _sender.StartTimer(); }