private void btnAddOmron501DataAquision_Click(object sender, EventArgs e) { Omron501Panel arPanel = new Omron501Panel(); arPanel.TopLevel = false; arPanel.Parent = mainFlowLayoutPanel; arPanel.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); } }