using Resources; using SmartCoalApplication.Resources; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace SmartCoalApplication.MeasureProcedure { public partial class InspectionItemMaintenance : Form { private string jianyanxiangmuName; private string guige1, guige2; private string compare1 ; private string compare2 ; private bool isEdit = false; public InspectionItemMaintenance(string jianyanxiangmuName, string guige1, string guige2, string compare1, string compare2,string word) { this.jianyanxiangmuName = jianyanxiangmuName; this.guige1 = guige1; this.guige2 = guige2; this.compare1 = compare1; this.compare2 = compare2; InitializeComponent(); InitializeComponent2(); this.Icon = PdnInfo.AppIcon; TextInitialize(word); } private void InitializeComponent2() { this.Text = PdnResources.GetString("NewMaintenanceInspectionItems"); this.label1.Text = PdnResources.GetString("NewName") + ":"; this.label2.Text = PdnResources.GetString("NewSpecificationName") + ":"; this.buttonConfirm.Text = PdnResources.GetString("NewConfirmation"); this.buttonCancel.Text = PdnResources.GetString("NewCancel"); } private void TextInitialize(string word) { if (word == "bianji") { textBoxName.Text = jianyanxiangmuName; textBoxSpecification1.Text = guige1; textBoxSpecification2.Text = guige2; if(compare1 == "L") { comboBoxCmpre1.SelectedItem = "<"; } else { comboBoxCmpre1.SelectedItem = "<="; } if (compare2 == "L") { comboBoxCmpre2.SelectedItem = "<"; } else { comboBoxCmpre2.SelectedItem = "<="; } //comboBoxCmpre2.SelectedItem = compare2; isEdit = true; } else { comboBoxCmpre1.SelectedItem = ">"; comboBoxCmpre2.SelectedItem = ">"; } comboBoxCmpre1.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxCmpre2.DropDownStyle = ComboBoxStyle.DropDownList; } // 创建委托 public delegate void TransferDataDelegate(string value,string guige1,string guige2, string cmpre1, string cmpre2,bool isEdit); // 声明一个事件(本质是一个委托) public event TransferDataDelegate TransferEvent; private void label2_Click(object sender, EventArgs e) { } private void InspectionItemMaintenance_Load(object sender, EventArgs e) { } private void buttonCancel_Click(object sender, EventArgs e) { this.Close(); } /// /// 確認 /// private void buttonConfirm_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxName.Text)) MessageBox.Show(PdnResources.GetString("NewNameCannotEmpty")); //单击按钮传递文本框中的数据 else { compare1 = comboBoxCmpre1.Text; compare2 = comboBoxCmpre2.Text; #region[替换字符:"L"-"<","Q"-"="] if (compare1 == "<") { compare1 = "L"; } if (compare1 == "<=") { compare1 = "LQ"; } if (compare2 == "<") { compare2 = "L"; } if (compare2 == "<=") { compare2 = "LQ"; } #endregion TransferEvent(textBoxName.Text, textBoxSpecification1.Text, textBoxSpecification2.Text, compare1, compare2, isEdit); this.Close();// 关闭窗体 } } } }