private void BtnConnect_Click(object sender, RoutedEventArgs e) { List <S7PLCHelper> list = new List <S7PLCHelper>(); foreach (var item in Equipments) { list.Add(new S7PLCHelper() { PLCIP = item.IP, PLCType = PLCType.S7_1500.ToString() }); } plc?.DisConnect(); plc = new S7Implement() { S7PLCHelpers = list }; var temp = plc.Connect(); if (temp.Success) { MessageBox.Show("连接成功"); } else { MessageBox.Show($"连接失败:{temp.Msg}"); } }
private void BtnOPCConnect_Click(object sender, RoutedEventArgs e) { plc = new OPCImplement("192.168.10.3") { Equipments = Equipments }; plc?.DisConnect(); var temp = plc.Connect(); if (temp.Success) { MessageBox.Show("连接成功"); } else { MessageBox.Show($"连接失败:{temp.Msg}"); } }