cloudflight
2024-11-25 2aa98318a41ddfb42d723810ff6dfb7bc3f9b79e
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 
 
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 = "¼ÆËãʧ°Ü";
            }
        }
 
        
    }
}