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; namespace CloudWaterNetwork.建模 { public partial class AddFactoryForm : Form { public AddFactoryForm() { InitializeComponent(); } public string FactoryName { get; set; } = ""; public FactoryType factoryType { get; set; } =FactoryType.水厂; private void btnAdd_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { FactoryName = txtName.Text; factoryType = (FactoryType)cmbType.SelectedItem; DialogResult = DialogResult.OK; Close(); } private void button2_Click(object sender, EventArgs e) { Close(); } private void AddFactoryForm_Load(object sender, EventArgs e) { txtName.Text = FactoryName; cmbType.DataSource = Enum.GetValues(typeof(FactoryType)); cmbType.SelectedItem = factoryType; } } }