static private void IniciaClienteCodigoFuente() { HeartBeatGenerator.UsarSerialHB = false; HeartBeatGenerator.ClientID = null; HbSenderPipe.IniciarHeartbeat(server, pipe, interv); Console.WriteLine("Simulador iniciado."); Console.WriteLine(messg); Console.ReadLine(); HbSenderPipe.DetenerHeartbeat(); }
// 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) { HeartBeatGenerator.ClientID = id; } else { HeartBeatGenerator.ClientID = null; } HeartBeatGenerator.TimestampFormat = format; HeartBeatGenerator.UsarSerialHB = useSerial; HbSenderPipe.IniciarHeartbeat(server, pipe, interv); }