cloudflight
2024-08-05 46f88867a2d3561a701535bcc6c41d0f76634b52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
 
using System;
using System.Windows.Forms;
using Yw.EPAnet.Calcu;
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;
            _net = new NetWork();
            bool result = _net.BuildFromInp(path);
            if (result) StatusLabel1.Text = "NetWork´´½¨³É¹¦";
            else StatusLabel1.Text = "NetWork´´½¨Ê§°Ü";
        }
 
        private void button3_Click(object sender, EventArgs e)
        {
            if (_net == null)
            {
                StatusLabel1.Text = "ÇëÏÈ´´½¨NetWork¶ÔÏó";
                return;
            }
            var list = _net.Calc();
            if (list != null)
            {
                StatusLabel1.Text = "¼ÆËã³É¹¦";
            }
            else
            {
                StatusLabel1.Text = "¼ÆËãʧ°Ü";
            }
        }
 
 
    }
}