using System; using System.IO; using System.Windows.Forms; using Yw.EPAnet; namespace EPACalcuTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //´ò¿ªÎļþ¶Ô»°¿ò£¬Ñ¡ÔñinpÀàÐ͵ÄÎļþ,½«Îļþ·¾¶ÏÔʾÔÚtextBox1ÖÐ OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "inpÎļþ|*.inp"; if (ofd.ShowDialog() == DialogResult.OK) { textBox1.Text = ofd.FileName; } } Network _net; private void button2_Click(object sender, EventArgs e) { //¶ÁÈ¡textBox1ÖеÄÎļþ·¾¶£¬µ÷ÓÃEPACalcuÀàÖеķ½·¨£¬´´½¨Ò»¸öNetwork¶ÔÏ󣬸³Öµ¸ø_net string path = textBox1.Text; try { _net = InpInteropHelper.FromInpString(path); StatusLabel1.Text = "NetWork´´½¨³É¹¦"; } catch { StatusLabel1.Text = "NetWork´´½¨Ê§°Ü"; } } private void button4_Click(object sender, EventArgs e) { var result=_net.Check(); if (result.Succeed) { StatusLabel1.Text = "ÑéÖ¤³É¹¦"; } else { StatusLabel1.Text = "Ñé֤ʧ°Ü"; } } private void button3_Click(object sender, EventArgs e) { if (_net == null) { StatusLabel1.Text = "ÇëÏÈ´´½¨NetWork¶ÔÏó"; return; } var cResult = _net.Calcu(CalcuMode.Simple); if (cResult.Succeed) { StatusLabel1.Text = "¼ÆËã³É¹¦"; } else { StatusLabel1.Text = "¼ÆËãʧ°Ü"; } } } }