InspectionItemMaintenance.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using Resources;
  2. using SmartCoalApplication.Resources;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace SmartCoalApplication.MeasureProcedure
  13. {
  14. public partial class InspectionItemMaintenance : Form
  15. {
  16. private string jianyanxiangmuName;
  17. private string guige1, guige2;
  18. private string compare1 ;
  19. private string compare2 ;
  20. private bool isEdit = false;
  21. public InspectionItemMaintenance(string jianyanxiangmuName, string guige1, string guige2, string compare1, string compare2,string word)
  22. {
  23. this.jianyanxiangmuName = jianyanxiangmuName;
  24. this.guige1 = guige1;
  25. this.guige2 = guige2;
  26. this.compare1 = compare1;
  27. this.compare2 = compare2;
  28. InitializeComponent();
  29. InitializeComponent2();
  30. this.Icon = PdnInfo.AppIcon;
  31. TextInitialize(word);
  32. }
  33. private void InitializeComponent2()
  34. {
  35. this.Text = PdnResources.GetString("NewMaintenanceInspectionItems");
  36. this.label1.Text = PdnResources.GetString("NewName") + ":";
  37. this.label2.Text = PdnResources.GetString("NewSpecificationName") + ":";
  38. this.buttonConfirm.Text = PdnResources.GetString("NewConfirmation");
  39. this.buttonCancel.Text = PdnResources.GetString("NewCancel");
  40. }
  41. private void TextInitialize(string word)
  42. {
  43. if (word == "bianji")
  44. {
  45. textBoxName.Text = jianyanxiangmuName;
  46. textBoxSpecification1.Text = guige1;
  47. textBoxSpecification2.Text = guige2;
  48. if(compare1 == "L")
  49. {
  50. comboBoxCmpre1.SelectedItem = "<";
  51. }
  52. else
  53. {
  54. comboBoxCmpre1.SelectedItem = "<=";
  55. }
  56. if (compare2 == "L")
  57. {
  58. comboBoxCmpre2.SelectedItem = "<";
  59. }
  60. else
  61. {
  62. comboBoxCmpre2.SelectedItem = "<=";
  63. }
  64. //comboBoxCmpre2.SelectedItem = compare2;
  65. isEdit = true;
  66. }
  67. else
  68. {
  69. comboBoxCmpre1.SelectedItem = ">";
  70. comboBoxCmpre2.SelectedItem = ">";
  71. }
  72. comboBoxCmpre1.DropDownStyle = ComboBoxStyle.DropDownList;
  73. comboBoxCmpre2.DropDownStyle = ComboBoxStyle.DropDownList;
  74. }
  75. // 创建委托
  76. public delegate void TransferDataDelegate(string value,string guige1,string guige2, string cmpre1, string cmpre2,bool isEdit);
  77. // 声明一个事件(本质是一个委托)
  78. public event TransferDataDelegate TransferEvent;
  79. private void label2_Click(object sender, EventArgs e)
  80. {
  81. }
  82. private void InspectionItemMaintenance_Load(object sender, EventArgs e)
  83. {
  84. }
  85. private void buttonCancel_Click(object sender, EventArgs e)
  86. {
  87. this.Close();
  88. }
  89. /// <summary>
  90. /// 確認
  91. /// </summary>
  92. private void buttonConfirm_Click(object sender, EventArgs e)
  93. {
  94. if (string.IsNullOrEmpty(textBoxName.Text))
  95. MessageBox.Show(PdnResources.GetString("NewNameCannotEmpty"));
  96. //单击按钮传递文本框中的数据
  97. else
  98. {
  99. compare1 = comboBoxCmpre1.Text;
  100. compare2 = comboBoxCmpre2.Text;
  101. #region[替换字符:"L"-"<","Q"-"="]
  102. if (compare1 == "<")
  103. {
  104. compare1 = "L";
  105. }
  106. if (compare1 == "<=")
  107. {
  108. compare1 = "LQ";
  109. }
  110. if (compare2 == "<")
  111. {
  112. compare2 = "L";
  113. }
  114. if (compare2 == "<=")
  115. {
  116. compare2 = "LQ";
  117. }
  118. #endregion
  119. TransferEvent(textBoxName.Text, textBoxSpecification1.Text, textBoxSpecification2.Text, compare1, compare2, isEdit);
  120. this.Close();// 关闭窗体
  121. }
  122. }
  123. }
  124. }