革博士V2程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

70 строки
2.2 KiB

  1. using GeBoShi.SysCtrl;
  2. using Newtonsoft.Json.Linq;
  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 GeBoShi.UI.InageShow
  13. {
  14. public partial class EditPauseFrm : Form
  15. {
  16. public List<string> lstCodes = new List<string>();
  17. private JArray DefectItemList;
  18. public EditPauseFrm(List<string> codes, JArray defectItemList)
  19. {
  20. InitializeComponent();
  21. DefectItemList = defectItemList;
  22. init(codes);
  23. }
  24. private void init(List<string> codes)
  25. {
  26. var list = DefectItemList.Select(x => new { code = x.Value<string>("code"), name = x.Value<string>("name") }).ToList();
  27. foreach (var item in list)
  28. {
  29. CheckBox uiCheckbox = new CheckBox();
  30. uiCheckbox.Height = 50;
  31. uiCheckbox.Width = 150;
  32. uiCheckbox.Tag = item.code;
  33. uiCheckbox.Text = item.name;
  34. if (codes == null || codes.Count == 0)
  35. uiCheckbox.Checked = true;
  36. else
  37. uiCheckbox.Checked = codes.Contains(item.code);
  38. this.flowLayoutPanel1.Controls.Add(uiCheckbox);
  39. }
  40. }
  41. private void skinButton1_Click(object sender, EventArgs e)
  42. {
  43. for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
  44. {
  45. CheckBox uiCheckbox = this.flowLayoutPanel1.Controls[i] as CheckBox;
  46. if (uiCheckbox.Checked)
  47. lstCodes.Add(uiCheckbox.Tag.ToString());
  48. }
  49. this.DialogResult = DialogResult.OK;
  50. //if (lstCodes.Count < 1)
  51. //{
  52. // MessageBox.Show("必需选择缺陷!","警告");
  53. // return;
  54. //}
  55. }
  56. private void skinButton2_Click(object sender, EventArgs e)
  57. {
  58. this.Close();
  59. this.DialogResult = DialogResult.Cancel;
  60. }
  61. }
  62. }