|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using Models;
- 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 LeatherApp.UIExtend
- {
- public partial class UIDefectEdit : UserControl
- {
- /// <summary>
- /// code,name
- /// </summary>
- public Action<string, string> CodeChangeEvent;
- public UIDefectEdit()
- {
- InitializeComponent();
- init();
- }
- private void init()
- {
- var list = Config.defectItemList.Select(x => new { code = x.Value<string>("code"), name = x.Value<string>("name") }).ToList();
- uiComboBox1.ValueMember = "code";
- uiComboBox1.DisplayMember = "name";
- uiComboBox1.DataSource = list;
- }
-
- [Description("忽略"), Category("自定义")]
- public bool Checked
- {
- get { return this.uiCheckBox1.Checked; }
- set { this.uiCheckBox1.Checked = value; }
- }
-
-
- [Description("瑕疵"), Category("自定义")]
- public string Code
- {
- get { return this.uiComboBox1.SelectedValue.ToString(); }
- set { this.uiComboBox1.SelectedValue = value; }
- }
-
- private void uiComboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- string code = uiComboBox1.SelectedValue.ToString();
- string name = uiComboBox1.SelectedText.ToString();
- if (this.Tag != null)
- {
- var item = (DefectInfo)this.Tag;
- item.Code = code;
- item.Name = name;
- }
- CodeChangeEvent?.Invoke(code,name);
- }
- }
- }
|