FrmSureAddCom.cs
3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using TSA_V.DeviceLibrary;
namespace TSA_V
{
public partial class FrmSureAddCom : FrmBase
{
public List<BoardInfo> boardInfos = new List<BoardInfo>();
public List<BoardInfo> SelBoardList = new List<BoardInfo>();
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmSureAddCom(List<BoardInfo> boardInfos)
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
LanguagePro();
this.boardInfos = boardInfos;
LoadBoardInfo();
}
private void LanguagePro()
{
this.dataGridViewImageColumn1.HeaderText = ResourceCulture.GetString(ResourceCulture.ItemText_Up, "上升");
this.dataGridViewImageColumn2.HeaderText = ResourceCulture.GetString(ResourceCulture.ItemText_Down, "下降");
this.Column_BoardName.HeaderText = ResourceCulture.GetString("boardName", "程序名称");
this.Column_bomName.HeaderText = ResourceCulture.GetString("bomName", "Bom名称");
this.Column_num.HeaderText = ResourceCulture.GetString("poingtNum", "组装数量");
this.Column_NeedAdd.HeaderText = ResourceCulture.GetString("NeedAdd", "需要添加");
}
private void FrmSureAddCom_Load(object sender, EventArgs e)
{
LanguageProcess();
LanguagePro();
}
private void LoadBoardInfo()
{
this.dgvList.Rows.Clear();
foreach (BoardInfo board in boardInfos)
{
if (board != null)
{
dgvList.Rows.Add(setBoard(null, board));
}
}
}
private DataGridViewRow setBoard(DataGridViewRow view, BoardInfo board)
{
if (view == null)
{
view = new DataGridViewRow();
view.CreateCells(dgvList);
}
view.Cells[Column_NeedAdd.Index].Value = true;
view.Cells[Column_bomName.Index].Value = board.bomName;
view.Cells[Column_BoardName.Index].Value = board.boardName;
view.Cells[Column_num.Index].Value = board.smtList.Count;
return view;
}
private bool isRun = false;
private bool IsProcess = false;
private void timer_Elapsed(object sender, EventArgs e)
{
if (IsProcess) { return; }
IsProcess = true;
IsProcess = false;
}
private void FrmBoardInfo_FormClosing(object sender, FormClosingEventArgs e)
{
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex != -1 && e.ColumnIndex >= 0)
{
}
}
private void btnSave_Click(object sender, EventArgs e)
{
SelBoardList = new List<BoardInfo>();
for (int i = 0; i < dgvList.Rows.Count; i++)
{
bool check = Convert.ToBoolean(dgvList.Rows[i].Cells[Column_NeedAdd.Index].Value);
if (check)
{
string boardName = Convert.ToString(dgvList.Rows[i].Cells[Column_BoardName.Index].Value);
var v = (from m in boardInfos where m.boardName == boardName select m).FirstOrDefault();
if (v != null)
{
SelBoardList.Add(v);
}
}
}
this.DialogResult = DialogResult.OK;
Close();
}
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
Close();
}
}
}