using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Xml.Linq; using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace CloudWaterNetwork.建模 { public partial class AddPumpForm : Form { public AddPumpForm() { InitializeComponent(); } public string PumpName { get; set; } = ""; public PumpType pumpType { get; set; } = PumpType.定速泵; public double 额定转速 { get; set; } = 1500; public double 额定流量 { get; set; } = 0; public double 额定扬程 { get; set; } = 0; public double 额定功率 { get; set; } = 0; private void btnAdd_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { PumpName = txtName.Text; pumpType = (PumpType)cmbType.SelectedItem; double d; 额定转速 = double.TryParse(textBox1.Text,out d ) ? d: 0; 额定流量 = double.TryParse(textBox2.Text, out d) ? d : 0; 额定扬程 = double.TryParse(textBox3.Text, out d) ? d : 0; 额定功率 = double.TryParse(textBox4.Text, out d) ? d : 0; DialogResult = DialogResult.OK; Close(); } private void button2_Click(object sender, EventArgs e) { Close(); } private void AddPumpForm_Load(object sender, EventArgs e) { textBox1.Text = 额定转速.ToString(); textBox2.Text = 额定流量.ToString(); textBox3.Text = 额定扬程.ToString(); textBox4.Text = 额定功率.ToString(); txtName.Text = PumpName; cmbType.DataSource = Enum.GetValues(typeof(PumpType)); cmbType.SelectedItem = pumpType; } private void label5_Click(object sender, EventArgs e) { } } }