|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using GeBoShi.SysCtrl;
- using Newtonsoft.Json.Linq;
- 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 GeBoShi.UI.InageShow
- {
-
- public partial class EditPauseFrm : Form
- {
- public List<string> lstCodes = new List<string>();
- private JArray DefectItemList;
- public EditPauseFrm(List<string> codes, JArray defectItemList)
- {
- InitializeComponent();
-
- DefectItemList = defectItemList;
-
- init(codes);
- }
-
- private void init(List<string> codes)
- {
- var list = DefectItemList.Select(x => new { code = x.Value<string>("code"), name = x.Value<string>("name") }).ToList();
- foreach (var item in list)
- {
- CheckBox uiCheckbox = new CheckBox();
- uiCheckbox.Height = 50;
- uiCheckbox.Width = 150;
- uiCheckbox.Tag = item.code;
- uiCheckbox.Text = item.name;
- if (codes == null || codes.Count == 0)
- uiCheckbox.Checked = true;
- else
- uiCheckbox.Checked = codes.Contains(item.code);
- this.flowLayoutPanel1.Controls.Add(uiCheckbox);
- }
- }
-
- private void skinButton1_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
- {
- CheckBox uiCheckbox = this.flowLayoutPanel1.Controls[i] as CheckBox;
- if (uiCheckbox.Checked)
- lstCodes.Add(uiCheckbox.Tag.ToString());
- }
- this.DialogResult = DialogResult.OK;
- //if (lstCodes.Count < 1)
- //{
- // MessageBox.Show("必需选择缺陷!","警告");
- // return;
- //}
- }
-
- private void skinButton2_Click(object sender, EventArgs e)
- {
- this.Close();
- this.DialogResult = DialogResult.Cancel;
- }
- }
- }
|