Exemple #1
0
        /// <summary>
        /// 切换Tab
        /// </summary>
        /// <param name="tab"></param>
        private void SelectedTab(TabPage tab)
        {
            Text = "IoTClient Tool - " + tab.Name;
            SaveTabName(tab.Name);
            if (tab.Controls.Count <= 0)
            {
                switch (tab.Name)
                {
                case "ModBusTcp":
                    var modBusTcp = new ModBusTcpControl();
                    modBusTcp.Dock = DockStyle.Fill;
                    tab.Controls.Add(modBusTcp);
                    break;

                case "ModBusRtu":
                    var modBusRtu = new ModBusRtuControl();
                    modBusRtu.Dock = DockStyle.Fill;
                    tab.Controls.Add(modBusRtu);
                    break;

                case "Siemens":
                    var siemens = new SiemensControl();
                    siemens.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemens);
                    break;

                case "BACnet":
                    var bacnet = new BACnetControl();
                    bacnet.Dock = DockStyle.Fill;
                    tab.Controls.Add(bacnet);
                    break;

                case "Ports":
                    var ports = new PortsControl();
                    ports.Dock = DockStyle.Fill;
                    tab.Controls.Add(ports);
                    break;
                }
            }
            else
            {
                switch (tab.Controls[0].Name)
                {
                case nameof(PortsControl):
                    var portsControl = tab.Controls[0] as PortsControl;
                    portsControl?.UpdatePortNames();
                    break;

                case nameof(ModBusRtuControl):
                    var modBusRtuControl = tab.Controls[0] as ModBusRtuControl;
                    modBusRtuControl?.UpdatePortNames();
                    break;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 切换Tab
        /// </summary>
        /// <param name="tab"></param>
        private void SelectedTab(TabPage tab)
        {
            Text = "IoTClient Tool - " + tab.Text?.Trim();
            SaveTabName(tab.Name);
            if (tab.Controls.Count <= 0)
            {
                switch (tab.Name)
                {
                case "ModBusTcp":
                    var modBusTcp = new ModBusTcpControl();
                    modBusTcp.Dock = DockStyle.Fill;
                    tab.Controls.Add(modBusTcp);
                    break;

                case "ModBusRtu":
                    var modBusRtu = new ModBusRtuControl();
                    modBusRtu.Dock = DockStyle.Fill;
                    tab.Controls.Add(modBusRtu);
                    break;

                case "ModBusAscii":
                    var modBusAscii = new ModBusAsciiControl();
                    modBusAscii.Dock = DockStyle.Fill;
                    tab.Controls.Add(modBusAscii);
                    break;

                case "Siemens":
                    var siemens = new SiemensControl();
                    siemens.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemens);
                    break;

                case "SiemensS7300":
                    var siemensS7_300 = new SiemensS7_300Control();
                    siemensS7_300.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemensS7_300);
                    break;

                case "BACnet":
                    var bacnet = new BACnetControl();
                    bacnet.Dock = DockStyle.Fill;
                    tab.Controls.Add(bacnet);
                    break;

                case "Ports":
                    var ports = new PortsControl();
                    ports.Dock = DockStyle.Fill;
                    tab.Controls.Add(ports);
                    break;

                case "MitsubishiMC":
                    var mitsubishiMC = new MitsubishiMCControl();
                    mitsubishiMC.Dock = DockStyle.Fill;
                    tab.Controls.Add(mitsubishiMC);
                    break;

                case "OmronFinsTcp":
                    var omronFinsTcp = new OmronFinsTcpControl();
                    omronFinsTcp.Dock = DockStyle.Fill;
                    tab.Controls.Add(omronFinsTcp);
                    break;

                case "Other":
                    var otherControl = new OtherControl();
                    otherControl.Dock = DockStyle.Fill;
                    tab.Controls.Add(otherControl);
                    break;
                }
            }
            else
            {
                switch (tab.Controls[0].Name)
                {
                case nameof(PortsControl):
                    var portsControl = tab.Controls[0] as PortsControl;
                    portsControl?.UpdatePortNames();
                    break;

                case nameof(ModBusRtuControl):
                    var modBusRtuControl = tab.Controls[0] as ModBusRtuControl;
                    modBusRtuControl?.UpdatePortNames();
                    break;
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 切换Tab
        /// </summary>
        /// <param name="tab"></param>
        private void SelectedTab(TabPage tab)
        {
            Text = "IoTClient Tool - " + tab.Name?.Trim();

            switch (tab.Name)
            {
            case "三菱_MC_Qna_3E":
                Text = "IoTClient Tool - 三菱MC Qna-3E";
                break;

            case "三菱_MC_A_1E":
                Text = "IoTClient Tool - 三菱MC A-1E";
                break;

            case "OmronFinsTcp":
                Text = "IoTClient Tool - 欧姆龙Fins";
                break;

            case "ModbusRtuOverTcp":
                Text = "IoTClient Tool - ModbusRtu Over Tcp [串口透传 即:用Tcp的方式发送Rtu格式报文]";
                break;

            case "ABCIP":
                Text = "IoTClient Tool - 罗克韦尔 Allen-Bradley CIP Beta";
                break;
            }

            SaveTabName(tab.Name);
            if (tab.Controls.Count <= 0)
            {
                switch (tab.Name)
                {
                case "ModbusTcp":
                    var modbusTcp = new ModbusTcpControl(false);
                    modbusTcp.Dock = DockStyle.Fill;
                    tab.Controls.Add(modbusTcp);
                    break;

                case "ModbusRtu":
                    var modbusRtu = new ModbusRtuControl();
                    modbusRtu.Dock = DockStyle.Fill;
                    tab.Controls.Add(modbusRtu);
                    break;

                case "ModbusRtuOverTcp":
                    var modbusTcpOverTcp = new ModbusTcpControl(true);
                    modbusTcpOverTcp.Dock = DockStyle.Fill;
                    tab.Controls.Add(modbusTcpOverTcp);
                    break;

                case "ModbusAscii":
                    var ModbusAscii = new ModbusAsciiControl();
                    ModbusAscii.Dock = DockStyle.Fill;
                    tab.Controls.Add(ModbusAscii);
                    break;

                case "西门子S7200Smart":
                    var siemens = new SiemensControl(SiemensVersion.S7_200Smart);
                    siemens.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemens);
                    break;

                case "西门子S7200":
                    var siemens200 = new SiemensControl(SiemensVersion.S7_200);
                    siemens200.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemens200);
                    break;

                case "西门子S7300":
                    var siemensS7_300 = new SiemensControl(SiemensVersion.S7_300);
                    siemensS7_300.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemensS7_300);
                    break;

                case "西门子S7400":
                    var siemensS7_400 = new SiemensControl(SiemensVersion.S7_400);
                    siemensS7_400.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemensS7_400);
                    break;

                case "西门子S71200":
                    var siemensS7_1200 = new SiemensControl(SiemensVersion.S7_1200);
                    siemensS7_1200.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemensS7_1200);
                    break;

                case "西门子S71500":
                    var siemensS7_1500 = new SiemensControl(SiemensVersion.S7_1500);
                    siemensS7_1500.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemensS7_1500);
                    break;

                case "BACnet":
                    var bacnet = new BACnetControl();
                    bacnet.Dock = DockStyle.Fill;
                    tab.Controls.Add(bacnet);
                    break;

                case "Ports":
                    var ports = new PortsControl();
                    ports.Dock = DockStyle.Fill;
                    tab.Controls.Add(ports);
                    break;

                case "三菱_MC_Qna_3E":
                    var mitsubishiMC = new MitsubishiMCControl(MitsubishiVersion.Qna_3E);
                    mitsubishiMC.Dock = DockStyle.Fill;
                    tab.Controls.Add(mitsubishiMC);
                    break;

                case "三菱_MC_A_1E":
                    var mitsubishiA1E = new MitsubishiMCControl(MitsubishiVersion.A_1E);
                    mitsubishiA1E.Dock = DockStyle.Fill;
                    tab.Controls.Add(mitsubishiA1E);
                    break;

                case "OmronFinsTcp":
                    var omronFinsTcp = new OmronFinsTcpControl();
                    omronFinsTcp.Dock = DockStyle.Fill;
                    tab.Controls.Add(omronFinsTcp);
                    break;

                case "ABCIP":
                    var allenBradley = new AllenBradleyControl();
                    allenBradley.Dock = DockStyle.Fill;
                    tab.Controls.Add(allenBradley);
                    break;

                case "MQTT":
                    var mqtt = new MQTTControl();
                    mqtt.Dock = DockStyle.Fill;
                    tab.Controls.Add(mqtt);
                    break;

                case "Other":
                    var otherControl = new OtherControl();
                    otherControl.Dock = DockStyle.Fill;
                    tab.Controls.Add(otherControl);
                    break;
                }
            }
            else
            {
                switch (tab.Controls[0].Name)
                {
                case nameof(PortsControl):
                    var portsControl = tab.Controls[0] as PortsControl;
                    portsControl?.UpdatePortNames();
                    break;

                case nameof(ModbusRtuControl):
                    var modbusRtuControl = tab.Controls[0] as ModbusRtuControl;
                    //tab 切换会覆盖选中的端口
                    //modbusRtuControl?.UpdatePortNames();
                    break;
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// 切换Tab
        /// </summary>
        /// <param name="tab"></param>
        private void SelectedTab(TabPage tab)
        {
            Text = "IoTClient Tool - " + tab.Name?.Trim();
            SaveTabName(tab.Name);
            if (tab.Controls.Count <= 0)
            {
                switch (tab.Name)
                {
                case "ModbusTcp":
                    var ModbusTcp = new ModbusTcpControl();
                    ModbusTcp.Dock = DockStyle.Fill;
                    tab.Controls.Add(ModbusTcp);
                    break;

                case "ModbusRtu":
                    var ModbusRtu = new ModbusRtuControl();
                    ModbusRtu.Dock = DockStyle.Fill;
                    tab.Controls.Add(ModbusRtu);
                    break;

                case "ModbusAscii":
                    var ModbusAscii = new ModbusAsciiControl();
                    ModbusAscii.Dock = DockStyle.Fill;
                    tab.Controls.Add(ModbusAscii);
                    break;

                case "SiemensS7200Smart":
                    var siemens = new SiemensControl(SiemensVersion.S7_200Smart);
                    siemens.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemens);
                    break;

                case "SiemensS7200":
                    var siemens200 = new SiemensControl(SiemensVersion.S7_200);
                    siemens200.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemens200);
                    break;

                case "SiemensS7300":
                    var siemensS7_300 = new SiemensControl(SiemensVersion.S7_300);
                    siemensS7_300.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemensS7_300);
                    break;

                case "SiemensS7400":
                    var siemensS7_400 = new SiemensControl(SiemensVersion.S7_400);
                    siemensS7_400.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemensS7_400);
                    break;

                case "SiemensS71200":
                    var siemensS7_1200 = new SiemensControl(SiemensVersion.S7_1200);
                    siemensS7_1200.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemensS7_1200);
                    break;

                case "SiemensS71500":
                    var siemensS7_1500 = new SiemensControl(SiemensVersion.S7_1500);
                    siemensS7_1500.Dock = DockStyle.Fill;
                    tab.Controls.Add(siemensS7_1500);
                    break;

                case "BACnet":
                    var bacnet = new BACnetControl();
                    bacnet.Dock = DockStyle.Fill;
                    tab.Controls.Add(bacnet);
                    break;

                case "Ports":
                    var ports = new PortsControl();
                    ports.Dock = DockStyle.Fill;
                    tab.Controls.Add(ports);
                    break;

                case "三菱_MC_Qna_3E":
                    var mitsubishiMC = new MitsubishiMCControl(MitsubishiVersion.Qna_3E);
                    mitsubishiMC.Dock = DockStyle.Fill;
                    tab.Controls.Add(mitsubishiMC);
                    break;

                case "三菱_MC_A_1E":
                    var mitsubishiA1E = new MitsubishiMCControl(MitsubishiVersion.A_1E);
                    mitsubishiA1E.Dock = DockStyle.Fill;
                    tab.Controls.Add(mitsubishiA1E);
                    break;

                case "OmronFinsTcp":
                    var omronFinsTcp = new OmronFinsTcpControl();
                    omronFinsTcp.Dock = DockStyle.Fill;
                    tab.Controls.Add(omronFinsTcp);
                    break;

                case "MQTT":
                    var mqtt = new MQTTControl();
                    mqtt.Dock = DockStyle.Fill;
                    tab.Controls.Add(mqtt);
                    break;

                case "Other":
                    var otherControl = new OtherControl();
                    otherControl.Dock = DockStyle.Fill;
                    tab.Controls.Add(otherControl);
                    break;
                }
            }
            else
            {
                switch (tab.Controls[0].Name)
                {
                case nameof(PortsControl):
                    var portsControl = tab.Controls[0] as PortsControl;
                    portsControl?.UpdatePortNames();
                    break;

                case nameof(ModbusRtuControl):
                    var modbusRtuControl = tab.Controls[0] as ModbusRtuControl;
                    modbusRtuControl?.UpdatePortNames();
                    break;
                }
            }
        }