private void btnAddMitsubishiFX3uDataAquision_Click(object sender, EventArgs e) { MitsubishiFX3uPanel acPanel = new MitsubishiFX3uPanel(); acPanel.TopLevel = false; acPanel.Parent = mainFlowLayoutPanel; acPanel.Show(); }
private void LoadLastCfgFile() { try { StreamReader sr = new StreamReader("DataAcquisitionConfig.ini", Encoding.Default); string line = null; while ((line = sr.ReadLine()) != null) { if (line == "Omron501Panel") { Omron501Panel panel = new Omron501Panel(); panel.TopLevel = false; panel.Show(); panel.Parent = mainFlowLayoutPanel; line = sr.ReadLine(); line = sr.ReadLine(); panel.IpAddr.Text = line; line = sr.ReadLine(); line = sr.ReadLine(); panel.Port.Text = line; } else if (line == "MitsubishiFX3uPanel") { MitsubishiFX3uPanel panel = new MitsubishiFX3uPanel(); panel.TopLevel = false; panel.Show(); panel.Parent = mainFlowLayoutPanel; line = sr.ReadLine(); line = sr.ReadLine(); panel.IpAddr.Text = line; line = sr.ReadLine(); line = sr.ReadLine(); panel.Port.Text = line; } else if (line == "Siemens1200Panel") { Siemens1200Panel panel = new Siemens1200Panel(); panel.TopLevel = false; panel.Show(); panel.Parent = mainFlowLayoutPanel; line = sr.ReadLine(); line = sr.ReadLine(); panel.IpAddr.Text = line; line = sr.ReadLine(); line = sr.ReadLine(); panel.Port.Text = line; } else if (line == "Siemens200Panel") { Siemens200Panel panel = new Siemens200Panel(); panel.TopLevel = false; panel.Show(); panel.Parent = mainFlowLayoutPanel; line = sr.ReadLine(); line = sr.ReadLine(); panel.IpAddr.Text = line; line = sr.ReadLine(); line = sr.ReadLine(); panel.Port.Text = line; } } sr.Close(); } catch (Exception ex) { MessageBox.Show("加载上一次关闭软件时的配置文件失败,原因:\n" + ex.Message); } }