private void BtnConnection_Click(object sender, EventArgs e) { //Added list of mids i want to use in my interpreter, every another will be desconsidered driver = new OpenProtocolDriver(new Type[] { typeof(Mid0002), typeof(Mid0005), typeof(Mid0004), typeof(Mid0003), typeof(ParameterSet.Mid0011), typeof(ParameterSet.Mid0013), typeof(Mid0035), typeof(Mid0031), typeof(Alarm.Mid0071), typeof(Alarm.Mid0074), typeof(Alarm.Mid0076), typeof(Vin.Mid0052), typeof(Mid0061), typeof(Mid0065), typeof(Time.Mid0081), typeof(Mid9999) }); var client = new Ethernet.SimpleTcpClient().Connect(textIp.Text, (int)numericPort.Value); if (driver.BeginCommunication(client)) { keepAliveTimer.Start(); connectionStatus.Text = "Connected!"; connectionStatus.BackColor = Color.Green; } else { driver = null; connectionStatus.Text = "Disconnected!"; connectionStatus.BackColor = Color.Red; } }
private void btnConnection_Click(object sender, EventArgs e) { //Added list of mids i want to use in my interpreter, every another will be desconsidered driver = new OpenProtocolDriver(new List <Mid>() { new Mid0002(), new Mid0005(), new Mid0004(), new Mid0003(), new ParameterSet.Mid0011(), new ParameterSet.Mid0013(), new Mid0035(), new Mid0031(), new Alarm.Mid0071(), new Alarm.Mid0074(), new Alarm.Mid0076(), new Vin.Mid0052(), new Mid0061(), new Mid0065(), new Time.Mid0081(), new Mid9999() }); if (driver.BeginCommunication(new Ethernet.SimpleTcpClient().Connect(textIp.Text, (int)numericPort.Value))) { keepAliveTimer.Start(); connectionStatus.Text = "Connected!"; connectionStatus.BackColor = Color.Green; } else { driver = null; connectionStatus.Text = "Disconnected!"; connectionStatus.BackColor = Color.Red; } }