| | |
| | | |
| | | |
| | | using System; |
| | | using System.IO; |
| | | using System.Windows.Forms; |
| | | using Yw.EPAnet.Calcu; |
| | | using Yw.EPAnet; |
| | | namespace EPACalcuTest |
| | | { |
| | | public partial class Form1 : Form |
| | |
| | | } |
| | | |
| | | |
| | | NetWork _net; |
| | | Network _net; |
| | | private void button2_Click(object sender, EventArgs e) |
| | | { |
| | | //读取textBox1中的文件路径,调用EPACalcu类中的方法,创建一个Network对象,赋值给_net |
| | | string path = textBox1.Text; |
| | | _net = new NetWork(); |
| | | bool result = _net.BuildFromInp(path); |
| | | if (result) StatusLabel1.Text = "NetWork创建成功"; |
| | | else StatusLabel1.Text = "NetWork创建失败"; |
| | | } |
| | | |
| | | 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 list = _net.Calc(); |
| | | if (list != null) |
| | | var cResult = _net.Calcu(CalcuMode.Simple); |
| | | if (cResult.Succeed) |
| | | { |
| | | StatusLabel1.Text = "计算成功"; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |