|
@@ -14,6 +14,7 @@ using System.Windows.Forms;
|
14
|
14
|
using Excel = Microsoft.Office.Interop.Excel;
|
15
|
15
|
using System.Reflection;
|
16
|
16
|
using Microsoft.WindowsAPICodePack.Dialogs;
|
|
17
|
+using System.Threading;
|
17
|
18
|
|
18
|
19
|
|
19
|
20
|
//using Microsoft.Office.Interop.Excel;
|
|
@@ -52,18 +53,40 @@ namespace APL_TestCheck
|
52
|
53
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
53
|
54
|
panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
54
|
55
|
panel_GpsMode.BackColor = Color.FromArgb(0, 159, 255);
|
|
56
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
57
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
55
|
58
|
}
|
56
|
59
|
else if (panel_Catm1Test.Visible == true)
|
57
|
60
|
{
|
58
|
61
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 255);
|
59
|
62
|
panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
60
|
63
|
panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
64
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
65
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
61
|
66
|
}
|
62
|
67
|
else if (panel_SensorTest.Visible == true)
|
63
|
68
|
{
|
64
|
69
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
65
|
70
|
panel_SensorMode.BackColor = Color.FromArgb(0, 159, 255);
|
66
|
71
|
panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
72
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
73
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
74
|
+ }
|
|
75
|
+ else if (panel_MergeMain.Visible == true)
|
|
76
|
+ {
|
|
77
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 255);
|
|
78
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
79
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
80
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
81
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
82
|
+ }
|
|
83
|
+ else if (panel_SnCheckMain.Visible == true)
|
|
84
|
+ {
|
|
85
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
86
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
87
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
88
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
89
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 255);
|
67
|
90
|
}
|
68
|
91
|
}
|
69
|
92
|
|
|
@@ -75,18 +98,40 @@ namespace APL_TestCheck
|
75
|
98
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
76
|
99
|
panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
77
|
100
|
panel_GpsMode.BackColor = Color.FromArgb(0, 159, 255);
|
|
101
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
102
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
78
|
103
|
}
|
79
|
104
|
else if (panel_Catm1Test.Visible == true)
|
80
|
105
|
{
|
81
|
106
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 255);
|
82
|
107
|
panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
83
|
108
|
panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
109
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
110
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
84
|
111
|
}
|
85
|
112
|
else if (panel_SensorTest.Visible == true)
|
86
|
113
|
{
|
87
|
114
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
88
|
115
|
panel_SensorMode.BackColor = Color.FromArgb(0, 159, 255);
|
89
|
116
|
panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
117
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
118
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
119
|
+ }
|
|
120
|
+ else if (panel_MergeMain.Visible == true)
|
|
121
|
+ {
|
|
122
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 255);
|
|
123
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
124
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
125
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
126
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
127
|
+ }
|
|
128
|
+ else if (panel_SnCheckMain.Visible == true)
|
|
129
|
+ {
|
|
130
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
131
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
132
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
133
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
134
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 255);
|
90
|
135
|
}
|
91
|
136
|
}
|
92
|
137
|
|
|
@@ -97,23 +142,138 @@ namespace APL_TestCheck
|
97
|
142
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
98
|
143
|
panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
99
|
144
|
panel_GpsMode.BackColor = Color.FromArgb(0, 159, 255);
|
|
145
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
146
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
100
|
147
|
}
|
101
|
148
|
else if (panel_Catm1Test.Visible == true)
|
102
|
149
|
{
|
103
|
150
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 255);
|
104
|
151
|
panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
105
|
152
|
panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
153
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
154
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
106
|
155
|
}
|
107
|
156
|
else if (panel_SensorTest.Visible == true)
|
108
|
157
|
{
|
109
|
158
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
110
|
159
|
panel_SensorMode.BackColor = Color.FromArgb(0, 159, 255);
|
111
|
160
|
panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
161
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
162
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
163
|
+ }
|
|
164
|
+ else if (panel_MergeMain.Visible == true)
|
|
165
|
+ {
|
|
166
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 255);
|
|
167
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
168
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
169
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
170
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
171
|
+ }
|
|
172
|
+ else if (panel_SnCheckMain.Visible == true)
|
|
173
|
+ {
|
|
174
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
175
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
176
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
177
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
178
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 255);
|
112
|
179
|
}
|
113
|
|
-
|
114
|
180
|
}
|
115
|
181
|
|
|
182
|
+ private void label_Merge_MouseLeave(object sender, EventArgs e)
|
|
183
|
+ {
|
|
184
|
+ if (panel_GpsTest.Visible == true)
|
|
185
|
+ {
|
|
186
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
187
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
188
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 255);
|
|
189
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
190
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
191
|
+ }
|
|
192
|
+ else if (panel_Catm1Test.Visible == true)
|
|
193
|
+ {
|
|
194
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 255);
|
|
195
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
196
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
197
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
198
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
199
|
+ }
|
|
200
|
+ else if (panel_SensorTest.Visible == true)
|
|
201
|
+ {
|
|
202
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
203
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 255);
|
|
204
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
205
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
206
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
207
|
+ }
|
|
208
|
+ else if (panel_MergeMain.Visible == true)
|
|
209
|
+ {
|
|
210
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 255);
|
|
211
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
212
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
213
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
214
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
215
|
+ }
|
|
216
|
+ else if(panel_SnCheckMain.Visible == true)
|
|
217
|
+ {
|
|
218
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
219
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
220
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
221
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
222
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 255);
|
|
223
|
+ }
|
|
224
|
+ }
|
|
225
|
+ private void label_SnCheck_MouseLeave(object sender, EventArgs e)
|
|
226
|
+ {
|
|
227
|
+ if (panel_GpsTest.Visible == true)
|
|
228
|
+ {
|
|
229
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
230
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
231
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 255);
|
|
232
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
233
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
234
|
+ }
|
|
235
|
+ else if (panel_Catm1Test.Visible == true)
|
|
236
|
+ {
|
|
237
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 255);
|
|
238
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
239
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
240
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
241
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
242
|
+ }
|
|
243
|
+ else if (panel_SensorTest.Visible == true)
|
|
244
|
+ {
|
|
245
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
246
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 255);
|
|
247
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
248
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
249
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
250
|
+ }
|
|
251
|
+ else if (panel_MergeMain.Visible == true)
|
|
252
|
+ {
|
|
253
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 255);
|
|
254
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
255
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
256
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
257
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 200);
|
|
258
|
+ }
|
|
259
|
+ else if (panel_SnCheckMain.Visible == true)
|
|
260
|
+ {
|
|
261
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 200);
|
|
262
|
+ panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 200);
|
|
263
|
+ panel_SensorMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
264
|
+ panel_GpsMode.BackColor = Color.FromArgb(0, 159, 200);
|
|
265
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 255);
|
|
266
|
+ }
|
|
267
|
+ }
|
116
|
268
|
|
|
269
|
+ private void label_SnCheck_MouseMove(object sender, MouseEventArgs e)
|
|
270
|
+ {
|
|
271
|
+ panel_SnCheck.BackColor = Color.FromArgb(0, 159, 255);
|
|
272
|
+ }
|
|
273
|
+ private void label_Merge_MouseMove(object sender, MouseEventArgs e)
|
|
274
|
+ {
|
|
275
|
+ panel_Merge.BackColor = Color.FromArgb(0, 159, 255);
|
|
276
|
+ }
|
117
|
277
|
private void label_Catm1Test_MouseMove(object sender, MouseEventArgs e)
|
118
|
278
|
{
|
119
|
279
|
panel_Catm1Mode.BackColor = Color.FromArgb(0, 159, 255);
|
|
@@ -178,6 +338,8 @@ namespace APL_TestCheck
|
178
|
338
|
panel_GpsTest.Visible = true;
|
179
|
339
|
panel_SensorTest.Visible = false;
|
180
|
340
|
panel_Catm1Test.Visible = false;
|
|
341
|
+ panel_MergeMain.Visible = false;
|
|
342
|
+ panel_SnCheckMain.Visible = false;
|
181
|
343
|
}
|
182
|
344
|
|
183
|
345
|
private void label_Catm1Test_Click(object sender, EventArgs e)
|
|
@@ -185,6 +347,8 @@ namespace APL_TestCheck
|
185
|
347
|
panel_GpsTest.Visible = false;
|
186
|
348
|
panel_SensorTest.Visible = false;
|
187
|
349
|
panel_Catm1Test.Visible = true;
|
|
350
|
+ panel_MergeMain.Visible = false;
|
|
351
|
+ panel_SnCheckMain.Visible = false;
|
188
|
352
|
|
189
|
353
|
}
|
190
|
354
|
|
|
@@ -193,6 +357,8 @@ namespace APL_TestCheck
|
193
|
357
|
panel_GpsTest.Visible = false;
|
194
|
358
|
panel_SensorTest.Visible = true;
|
195
|
359
|
panel_Catm1Test.Visible = false;
|
|
360
|
+ panel_MergeMain.Visible = false;
|
|
361
|
+ panel_SnCheckMain.Visible = false;
|
196
|
362
|
}
|
197
|
363
|
|
198
|
364
|
private void Main_Load(object sender, EventArgs e)
|
|
@@ -204,16 +370,18 @@ namespace APL_TestCheck
|
204
|
370
|
panel_GpsTest.Visible = true;
|
205
|
371
|
panel_SensorTest.Visible = false;
|
206
|
372
|
panel_Catm1Test.Visible = false;
|
|
373
|
+ panel_MergeMain.Visible = false;
|
207
|
374
|
pictureBox_Check1.Visible = false;
|
208
|
375
|
pictureBox_Check2.Visible = false;
|
209
|
376
|
pictureBox_Check3.Visible = false;
|
210
|
377
|
pictureBox_Check4.Visible = false;
|
|
378
|
+
|
211
|
379
|
}
|
212
|
380
|
public void Serial_Initialize(ref ComboBox cb_port)
|
213
|
381
|
{
|
214
|
382
|
|
215
|
383
|
this.serialPort = new System.IO.Ports.SerialPort();
|
216
|
|
- this.serialPort.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.Serial_DataRecvFunction);
|
|
384
|
+ this.serialPort.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.sPort_DataReceived);
|
217
|
385
|
|
218
|
386
|
cb_port.BeginUpdate();
|
219
|
387
|
foreach (string comport in SerialPort.GetPortNames())//foreach (string comport in SerialPort_TestProgram.GetPortNames())
|
|
@@ -236,25 +404,88 @@ namespace APL_TestCheck
|
236
|
404
|
|
237
|
405
|
}
|
238
|
406
|
private delegate void StringSend(string Text);
|
|
407
|
+ private delegate void ByteSend(byte[] Text);
|
|
408
|
+
|
|
409
|
+ string startStr ="V";
|
|
410
|
+ string endStr = "\n";
|
239
|
411
|
public void Serial_DataRecvFunction(object sender, SerialDataReceivedEventArgs e)
|
240
|
412
|
{
|
241
|
|
-
|
|
413
|
+ int TmpLength = 0;
|
|
414
|
+ //System.Threading.Thread.Sleep(50);
|
242
|
415
|
int nLnegth = serialPort.BytesToRead;
|
243
|
416
|
byte[] btdata = new byte[nLnegth];
|
|
417
|
+
|
244
|
418
|
serialPort.Read(btdata, 0, nLnegth);
|
245
|
419
|
string data = Encoding.Default.GetString(btdata);
|
246
|
|
-
|
247
|
420
|
if (checkBox_TerminalStop.Checked == true)
|
248
|
421
|
return;
|
249
|
422
|
// string data = serialPort.ReadExisting();
|
250
|
|
- this.Invoke(new StringSend(Data_Recv_Str), data);
|
|
423
|
+ if (panel_SensorTest.Visible == true)
|
|
424
|
+ {
|
|
425
|
+ if (data.Contains(startStr))
|
|
426
|
+ {
|
|
427
|
+ data = data.Substring(data.IndexOf(startStr));
|
|
428
|
+ if (data.Contains(endStr))
|
|
429
|
+ {
|
|
430
|
+ this.Invoke(new StringSend(Data_Recv_Str), data);
|
|
431
|
+ }
|
|
432
|
+ }
|
|
433
|
+
|
|
434
|
+ }
|
|
435
|
+ else
|
|
436
|
+ {
|
|
437
|
+ this.Invoke(new StringSend(Data_Recv_Str), data);
|
|
438
|
+ }
|
|
439
|
+ /*try
|
|
440
|
+ {
|
|
441
|
+ this.Invoke(new ByteSend(Data_Recv_Str), btdata);
|
|
442
|
+ }
|
|
443
|
+ catch
|
|
444
|
+ {
|
|
445
|
+
|
|
446
|
+ }*/
|
251
|
447
|
/****
|
252
|
448
|
*메모리 누수 방지용 코드
|
253
|
449
|
*/
|
254
|
450
|
System.GC.Collect(0, GCCollectionMode.Forced);
|
255
|
451
|
System.GC.WaitForFullGCComplete();
|
256
|
452
|
}
|
|
453
|
+ int offset = 0;
|
|
454
|
+ byte[] rxBuffer;
|
|
455
|
+ private void sPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
|
456
|
+ {
|
|
457
|
+
|
|
458
|
+ if (offset == 0)
|
|
459
|
+ {
|
|
460
|
+ rxBuffer = new byte[4096];
|
|
461
|
+ }
|
257
|
462
|
|
|
463
|
+ string rxString = "";
|
|
464
|
+ int intRecSize = serialPort.BytesToRead;
|
|
465
|
+
|
|
466
|
+ if (intRecSize != 0)
|
|
467
|
+ {
|
|
468
|
+ serialPort.Read(rxBuffer, offset, intRecSize);
|
|
469
|
+ offset += intRecSize;
|
|
470
|
+
|
|
471
|
+ for (int iTemp = 0; iTemp < offset; iTemp++)
|
|
472
|
+ {
|
|
473
|
+ rxString += Convert.ToChar(rxBuffer[iTemp]);
|
|
474
|
+ }
|
|
475
|
+
|
|
476
|
+ if (rxString.Contains(startStr))
|
|
477
|
+ {
|
|
478
|
+ rxString = rxString.Substring(rxString.IndexOf(startStr));
|
|
479
|
+ if (rxString.Contains(endStr))
|
|
480
|
+ {
|
|
481
|
+ this.Invoke(new StringSend(Data_Recv_Str), rxString);
|
|
482
|
+ //program.dataReceived(rxString, "Receive");
|
|
483
|
+ offset = 0;
|
|
484
|
+ }
|
|
485
|
+ }
|
|
486
|
+ }
|
|
487
|
+ }
|
|
488
|
+
|
258
|
489
|
private void label_Port_MouseClick(object sender, MouseEventArgs e)
|
259
|
490
|
{
|
260
|
491
|
|
|
@@ -306,6 +537,11 @@ namespace APL_TestCheck
|
306
|
537
|
{
|
307
|
538
|
tbReceived.AppendText(GPS_TestFunc(text));
|
308
|
539
|
}
|
|
540
|
+ else if(panel_SensorTest.Visible == true)
|
|
541
|
+ {
|
|
542
|
+ Sensor_TestFunc(text);
|
|
543
|
+ tbReceived.AppendText(text);
|
|
544
|
+ }
|
309
|
545
|
else
|
310
|
546
|
{
|
311
|
547
|
tbReceived.AppendText(text);
|
|
@@ -315,6 +551,65 @@ namespace APL_TestCheck
|
315
|
551
|
}
|
316
|
552
|
catch { try { SendMessage(this.Handle, WM_SETREDRAW, true, 0); } catch { return; } }
|
317
|
553
|
}
|
|
554
|
+ public void Data_Recv_Str(byte[] text)
|
|
555
|
+ {
|
|
556
|
+ string strtext = Encoding.Default.GetString(text);
|
|
557
|
+
|
|
558
|
+ System.Windows.Forms.RichTextBox tbReceived = null;
|
|
559
|
+ if (panel_GpsTest.Visible == true)
|
|
560
|
+ {
|
|
561
|
+ tbReceived = richTextBox_Gps;
|
|
562
|
+
|
|
563
|
+ }
|
|
564
|
+ else if (panel_Catm1Test.Visible == true)
|
|
565
|
+ {
|
|
566
|
+ tbReceived = richTextBox_catm1;
|
|
567
|
+ }
|
|
568
|
+ else if (panel_SensorTest.Visible == true)
|
|
569
|
+ {
|
|
570
|
+ tbReceived = richTextBox_Sensor;
|
|
571
|
+ }
|
|
572
|
+
|
|
573
|
+ int nLimitLines = Convert.ToInt32(LineLimit); //제한 라인 수
|
|
574
|
+ try
|
|
575
|
+ {
|
|
576
|
+ try
|
|
577
|
+ {
|
|
578
|
+ SendMessage(this.Handle, WM_SETREDRAW, false, 0);
|
|
579
|
+ }
|
|
580
|
+ catch (Exception e) { MessageBox.Show(e.StackTrace); }
|
|
581
|
+ if (tbReceived.Lines.Length > nLimitLines)
|
|
582
|
+ {
|
|
583
|
+ LinkedList<string> tempLines = new LinkedList<string>(tbReceived.Lines);
|
|
584
|
+ while ((tempLines.Count - nLimitLines) > 0)
|
|
585
|
+ {
|
|
586
|
+ tempLines.RemoveFirst();
|
|
587
|
+ }
|
|
588
|
+ tbReceived.Lines = tempLines.ToArray();
|
|
589
|
+ }
|
|
590
|
+ try
|
|
591
|
+ {
|
|
592
|
+ SendMessage(this.Handle, WM_SETREDRAW, true, 0);
|
|
593
|
+ }
|
|
594
|
+ catch { return; }
|
|
595
|
+ if (checkBox_GPGSV.Checked == true && panel_GpsTest.Visible == true)
|
|
596
|
+ {
|
|
597
|
+ tbReceived.AppendText(GPS_TestFunc(Encoding.Default.GetString(text)));
|
|
598
|
+ }
|
|
599
|
+ else if (panel_SensorTest.Visible == true)
|
|
600
|
+ {
|
|
601
|
+ Sensor_TestFunc(strtext);
|
|
602
|
+ tbReceived.AppendText(strtext);
|
|
603
|
+ }
|
|
604
|
+ else
|
|
605
|
+ {
|
|
606
|
+ tbReceived.AppendText(strtext);
|
|
607
|
+ }
|
|
608
|
+ tbReceived.SelectionStart = tbReceived.Text.Length;//맨 마지막 선택...
|
|
609
|
+ tbReceived.ScrollToCaret();
|
|
610
|
+ }
|
|
611
|
+ catch { try { SendMessage(this.Handle, WM_SETREDRAW, true, 0); } catch { return; } }
|
|
612
|
+ }
|
318
|
613
|
public int WordNum(String data, String fixdata)
|
319
|
614
|
{
|
320
|
615
|
MatchCollection matches = Regex.Matches(data, fixdata);
|
|
@@ -418,6 +713,71 @@ namespace APL_TestCheck
|
418
|
713
|
catch (Exception e) { /*MessageBox.Show(e.StackTrace); */}
|
419
|
714
|
return "";
|
420
|
715
|
}
|
|
716
|
+ string SensorData = null;
|
|
717
|
+ private void Sensor_TestFunc(string data)
|
|
718
|
+ {
|
|
719
|
+ string str = data;
|
|
720
|
+ string[] sp = new string[11];
|
|
721
|
+ try
|
|
722
|
+ {
|
|
723
|
+ if (data.Contains("\r\n") == false)
|
|
724
|
+ {
|
|
725
|
+ return;
|
|
726
|
+ }
|
|
727
|
+ else
|
|
728
|
+ {
|
|
729
|
+ SensorData += data;
|
|
730
|
+ str = SensorData;
|
|
731
|
+ }
|
|
732
|
+
|
|
733
|
+ if (dataGridView_Sensor.Rows[0].Cells[0].Value != null)
|
|
734
|
+ {
|
|
735
|
+ //location1 = str.IndexOf("\r\n");
|
|
736
|
+ //str = str.Substring(0, location1);
|
|
737
|
+ sp = str.Split(',');
|
|
738
|
+ if (sp[0].Contains("V") == false/* || sp.Length != 11*/)
|
|
739
|
+ {
|
|
740
|
+ SensorData = null;
|
|
741
|
+ return;
|
|
742
|
+ }
|
|
743
|
+
|
|
744
|
+ dataGridView_Sensor.Rows[0].Cells[5].Value = sp[0]; //version
|
|
745
|
+ dataGridView_Sensor.Rows[0].Cells[2].Value = sp[2]; //,IMEI
|
|
746
|
+ dataGridView_Sensor.Rows[0].Cells[3].Value = sp[3];//, Phone Number,
|
|
747
|
+ dataGridView_Sensor.Rows[0].Cells[4].Value = sp[4];//USIM Number
|
|
748
|
+ dataGridView_Sensor.Rows[0].Cells[6].Value = sp[5];//, Battery Voltage,
|
|
749
|
+ dataGridView_Sensor.Rows[0].Cells[7].Value = sp[6];// System Voltage,
|
|
750
|
+ dataGridView_Sensor.Rows[0].Cells[8].Value = sp[7];//Temp, BMA400 값 출력 x, y, z
|
|
751
|
+ dataGridView_Sensor.Rows[0].Cells[9].Value = sp[8];//Temp, BMA400 값 출력 x, y, z
|
|
752
|
+ dataGridView_Sensor.Rows[0].Cells[10].Value = sp[9];//Temp, BMA400 값 출력 x, y, z
|
|
753
|
+ if (sp[10].Contains("\r"))
|
|
754
|
+ {
|
|
755
|
+ int loc = sp[10].IndexOf("\r");
|
|
756
|
+ sp[10] = sp[10].Substring(0, loc);
|
|
757
|
+ }
|
|
758
|
+ dataGridView_Sensor.Rows[0].Cells[11].Value = sp[10];//Temp, BMA400 값 출력 x, y, z
|
|
759
|
+ SensorData = null;
|
|
760
|
+ string value = "";
|
|
761
|
+ if (checkBox_Edit.Checked == false)
|
|
762
|
+ {
|
|
763
|
+ if (InputBox("번호 입력", "일련 번호:", ref value) == DialogResult.OK)
|
|
764
|
+ {
|
|
765
|
+ // SN
|
|
766
|
+ dataGridView_Sensor.Rows[0].Cells[1].Value = Name = value;
|
|
767
|
+ serialPort.Write(value);
|
|
768
|
+ button_SensorTestSave();
|
|
769
|
+ for (int i = 0; i < 12; i++)
|
|
770
|
+ dataGridView_Sensor.Rows[0].Cells[i].Value = null;
|
|
771
|
+
|
|
772
|
+ }
|
|
773
|
+ }
|
|
774
|
+ dataGridView_Sensor.Refresh();
|
|
775
|
+
|
|
776
|
+ }
|
|
777
|
+ return;
|
|
778
|
+ }
|
|
779
|
+ catch (Exception ex) { /*MessageBox.Show(ex.StackTrace); */ }
|
|
780
|
+ }
|
421
|
781
|
private void label_Port_MouseLeave(object sender, EventArgs e)
|
422
|
782
|
{
|
423
|
783
|
panel_Port.BackColor = Color.FromArgb(0, 159, 200);
|
|
@@ -506,41 +866,7 @@ namespace APL_TestCheck
|
506
|
866
|
return dialogResult;
|
507
|
867
|
}
|
508
|
868
|
|
509
|
|
- private void dataGridView_Sensor_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
510
|
|
- {
|
511
|
|
- /* string value = "";
|
512
|
|
- if (checkBox_Edit.Checked == false)
|
513
|
|
- {
|
514
|
|
- if (InputBox("번호 입력", "일련 번호:", ref value) == DialogResult.OK)
|
515
|
|
- {
|
516
|
|
- Name = value;
|
517
|
|
- }
|
518
|
|
- }*/
|
519
|
|
- }
|
520
|
|
-
|
521
|
|
- private void dataGridView_Catm1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
522
|
|
- {
|
523
|
|
- /* string value = "";
|
524
|
|
- if (checkBox_Edit.Checked == false)
|
525
|
|
- {
|
526
|
|
- if (InputBox("번호 입력", "일련 번호:", ref value) == DialogResult.OK)
|
527
|
|
- {
|
528
|
|
- Name = value;
|
529
|
|
- }
|
530
|
|
- }*/
|
531
|
|
- }
|
532
|
869
|
|
533
|
|
- private void dataGridView_Gps_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
534
|
|
- {
|
535
|
|
- /* string value = "";
|
536
|
|
- if (checkBox_Edit.Checked == false)
|
537
|
|
- {
|
538
|
|
- if (InputBox("번호 입력", "일련 번호:", ref value) == DialogResult.OK)
|
539
|
|
- {
|
540
|
|
- Name = value;
|
541
|
|
- }
|
542
|
|
- }*/
|
543
|
|
- }
|
544
|
870
|
|
545
|
871
|
private void button_Clear_Click(object sender, EventArgs e)
|
546
|
872
|
{
|
|
@@ -610,7 +936,7 @@ namespace APL_TestCheck
|
610
|
936
|
{
|
611
|
937
|
try
|
612
|
938
|
{
|
613
|
|
- File.Copy(Ref_Xls_File, Dst_Xls_File, true);
|
|
939
|
+ // File.Copy(Ref_Xls_File, Dst_Xls_File, true);
|
614
|
940
|
}
|
615
|
941
|
catch (Exception ex)
|
616
|
942
|
{
|
|
@@ -644,7 +970,7 @@ namespace APL_TestCheck
|
644
|
970
|
Gps_DataxlsWrite(Dst_Xls_File);
|
645
|
971
|
dataGridView_Gps.Rows[0].Cells[0].Value = null;
|
646
|
972
|
dataGridView_Gps.Rows[0].Cells[1].Value = null;
|
647
|
|
-
|
|
973
|
+ dataGridView_Gps.Refresh();
|
648
|
974
|
// if (!di.Exists) { di.Create(); }
|
649
|
975
|
//string tmppath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
650
|
976
|
#if false
|
|
@@ -661,7 +987,107 @@ namespace APL_TestCheck
|
661
|
987
|
}
|
662
|
988
|
#endif
|
663
|
989
|
}
|
|
990
|
+ private void button_SensorTestSave()
|
|
991
|
+ {
|
|
992
|
+ string CheckProductionNum = null;
|
|
993
|
+ try
|
|
994
|
+ {
|
|
995
|
+ CheckProductionNum = dataGridView_Sensor.Rows[0].Cells[0].Value.ToString();
|
|
996
|
+ }
|
|
997
|
+ catch
|
|
998
|
+ {
|
|
999
|
+
|
|
1000
|
+ }
|
|
1001
|
+ try
|
|
1002
|
+ {
|
|
1003
|
+ if (!CheckProductionNum.Contains("BL-VITE00-V"))
|
|
1004
|
+ {
|
|
1005
|
+ MessageBox.Show("잘못된 생산 번호 입니다.");
|
|
1006
|
+ return;
|
|
1007
|
+ }
|
|
1008
|
+ }
|
|
1009
|
+ catch
|
|
1010
|
+ {
|
|
1011
|
+ MessageBox.Show("생산번호를 적어주세요.");
|
|
1012
|
+ }
|
|
1013
|
+ string Ref_Xls_File = new System.IO.DirectoryInfo(System.Windows.Forms.Application.StartupPath).ToString();
|
|
1014
|
+ string Dst_Xls_File = null;
|
|
1015
|
+ Ref_Xls_File = Ref_Xls_File + @"\APL_200221.xls";
|
|
1016
|
+ FileInfo SrcfileInfo = new FileInfo(Ref_Xls_File);
|
|
1017
|
+ FileInfo DstfileInfo;
|
664
|
1018
|
|
|
1019
|
+ if (dataGridView_Sensor.Rows[0].Cells[0].Value != null)
|
|
1020
|
+ {
|
|
1021
|
+ if (SrcfileInfo.Exists)
|
|
1022
|
+ {
|
|
1023
|
+ if (FileSaveSet == null)
|
|
1024
|
+ {
|
|
1025
|
+ button_Path_Click(null, null);
|
|
1026
|
+ return;
|
|
1027
|
+ // MessageBox.Show("레퍼런스 엑셀 파일이 존재하지 않습니다. \r\n강차장님에게 문의 하세요.");
|
|
1028
|
+ }
|
|
1029
|
+ else
|
|
1030
|
+ {
|
|
1031
|
+ // File Copy 후 Data 입력
|
|
1032
|
+ Dst_Xls_File = FileSaveSet + @"\" + dataGridView_Sensor.Rows[0].Cells[0].Value.ToString() + @".xls";
|
|
1033
|
+ DstfileInfo = new FileInfo(Dst_Xls_File);
|
|
1034
|
+ if (DstfileInfo.Exists)
|
|
1035
|
+ {
|
|
1036
|
+ if (MessageBox.Show("이미 파일이 있습니다.\r\n 덮어씌우겠습니까?", "YesOrNo", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
1037
|
+ {
|
|
1038
|
+ try
|
|
1039
|
+ {
|
|
1040
|
+ // File.Copy(Ref_Xls_File, Dst_Xls_File, true);
|
|
1041
|
+ }
|
|
1042
|
+ catch (Exception ex)
|
|
1043
|
+ {
|
|
1044
|
+ MessageBox.Show(ex.StackTrace);
|
|
1045
|
+ return;
|
|
1046
|
+ }
|
|
1047
|
+ }
|
|
1048
|
+ else
|
|
1049
|
+ {
|
|
1050
|
+ //MessageBox.Show("아니요 클릭");
|
|
1051
|
+ return; // 아니오시 Return;
|
|
1052
|
+ }
|
|
1053
|
+ }
|
|
1054
|
+ else
|
|
1055
|
+ {
|
|
1056
|
+ File.Copy(Ref_Xls_File, Dst_Xls_File);
|
|
1057
|
+ }
|
|
1058
|
+ }
|
|
1059
|
+ }
|
|
1060
|
+ else
|
|
1061
|
+ {
|
|
1062
|
+ MessageBox.Show("레퍼런스 엑셀 파일이 존재하지 않습니다. \r\n강차장님에게 문의 하세요.");
|
|
1063
|
+ return;
|
|
1064
|
+ }
|
|
1065
|
+ }
|
|
1066
|
+ else
|
|
1067
|
+ {
|
|
1068
|
+ MessageBox.Show("생산번호 값이 제대로 입력 되지 않았습니다.\r\n확인후 다시 저장하세요.");
|
|
1069
|
+ return;
|
|
1070
|
+ }
|
|
1071
|
+ Sensor_DataxlsWrite(Dst_Xls_File);
|
|
1072
|
+ // dataGridView_Sensor.Rows[0].Cells[0].Value = null;
|
|
1073
|
+ // dataGridView_Sensor.Rows[0].Cells[1].Value = null;
|
|
1074
|
+
|
|
1075
|
+ // if (!di.Exists) { di.Create(); }
|
|
1076
|
+ //string tmppath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
|
1077
|
+#if false
|
|
1078
|
+ if (dataGridView_Gps.Rows[0].Cells[1].Value != null)
|
|
1079
|
+ {
|
|
1080
|
+ string path = @"xxxx.txt";
|
|
1081
|
+ FileInfo file = new FileInfo(path);
|
|
1082
|
+ if (file.Exists)
|
|
1083
|
+ { //파일이 있는지
|
|
1084
|
+ //복사(경로,덮어쓰기 옵션 기본값 false)
|
|
1085
|
+ //만약 덮어쓰기 false일 때 파일이 존재하면 에러남.
|
|
1086
|
+ file.CopyTo(@"xxx2.txt", true);
|
|
1087
|
+ }
|
|
1088
|
+ }
|
|
1089
|
+#endif
|
|
1090
|
+ }
|
665
|
1091
|
|
666
|
1092
|
Excel.Application ExcelApp = null;
|
667
|
1093
|
Excel.Workbook wb = null;
|
|
@@ -685,8 +1111,8 @@ namespace APL_TestCheck
|
685
|
1111
|
|
686
|
1112
|
//엑셀 시트 인덱스 번호는 0,0 부터 시작 하는 것이 아니라 1,1 A1 부터 시작 함. 0,0 으로 시작하면 오류...
|
687
|
1113
|
//시트에 값 쓰기...
|
688
|
|
- ws.Cells[8, 8] = dataGridView_Gps.Rows[0].Cells[0].Value;
|
689
|
|
- ws.Cells[8, 10] = dataGridView_Gps.Rows[0].Cells[1].Value;
|
|
1114
|
+ ws.Cells[8, 9] = dataGridView_Gps.Rows[0].Cells[0].Value;
|
|
1115
|
+ ws.Cells[8, 11] = dataGridView_Gps.Rows[0].Cells[1].Value;
|
690
|
1116
|
/*ws.Cells[1, 3] = "123";
|
691
|
1117
|
ws.Cells[1, 4] = "1234";
|
692
|
1118
|
ws.Cells[2, 1] = "Test1"; //A2
|
|
@@ -731,6 +1157,80 @@ namespace APL_TestCheck
|
731
|
1157
|
GC.Collect();
|
732
|
1158
|
}
|
733
|
1159
|
}
|
|
1160
|
+ private void Sensor_DataxlsWrite(string dst)
|
|
1161
|
+ {
|
|
1162
|
+ //Write
|
|
1163
|
+
|
|
1164
|
+ //파일이 존재 한다면..삭제 하고..
|
|
1165
|
+ /*if (File.Exists("C:\\Test.xls"))
|
|
1166
|
+ {
|
|
1167
|
+ File.Delete("C:\\Test.xls");
|
|
1168
|
+ }*/
|
|
1169
|
+ try
|
|
1170
|
+ {
|
|
1171
|
+ ExcelApp = new Excel.Application();
|
|
1172
|
+ wb = ExcelApp.Workbooks.Open(dst, 0, false, 5, Missing.Value, Missing.Value, false, Missing.Value,
|
|
1173
|
+ Missing.Value, true, false, Missing.Value, false, false, false);
|
|
1174
|
+ ws = wb.Worksheets["Sheet1"] as Excel.Worksheet;
|
|
1175
|
+
|
|
1176
|
+ //엑셀 시트 인덱스 번호는 0,0 부터 시작 하는 것이 아니라 1,1 A1 부터 시작 함. 0,0 으로 시작하면 오류...
|
|
1177
|
+ //시트에 값 쓰기...
|
|
1178
|
+ ws.Cells[8, 9] = dataGridView_Sensor.Rows[0].Cells[0].Value; // 제조 번호
|
|
1179
|
+ ws.Cells[8, 4] = dataGridView_Sensor.Rows[0].Cells[1].Value; // 일련번호
|
|
1180
|
+ ws.Cells[8, 6] = dataGridView_Sensor.Rows[0].Cells[2].Value; //IMEI
|
|
1181
|
+ ws.Cells[8, 7] = dataGridView_Sensor.Rows[0].Cells[3].Value;// PHONE
|
|
1182
|
+ ws.Cells[8, 8] = dataGridView_Sensor.Rows[0].Cells[4].Value;//USIM
|
|
1183
|
+ ws.Cells[8, 10] = dataGridView_Sensor.Rows[0].Cells[5].Value;//VER
|
|
1184
|
+ ws.Cells[8, 13] = dataGridView_Sensor.Rows[0].Cells[6].Value;//BATT
|
|
1185
|
+ ws.Cells[8, 14] = dataGridView_Sensor.Rows[0].Cells[7].Value;//SYS
|
|
1186
|
+ ws.Cells[8, 15] = dataGridView_Sensor.Rows[0].Cells[8].Value;//TEMP
|
|
1187
|
+ ws.Cells[8, 16] = dataGridView_Sensor.Rows[0].Cells[9].Value;//BMA
|
|
1188
|
+ ws.Cells[8, 17] = dataGridView_Sensor.Rows[0].Cells[10].Value;//BMA
|
|
1189
|
+ ws.Cells[8, 18] = dataGridView_Sensor.Rows[0].Cells[11].Value;//BMA
|
|
1190
|
+ /*ws.Cells[1, 3] = "123";
|
|
1191
|
+ ws.Cells[1, 4] = "1234";
|
|
1192
|
+ ws.Cells[2, 1] = "Test1"; //A2
|
|
1193
|
+ ws.Cells[3, 1] = "Test12"; //A3
|
|
1194
|
+ ws.Cells[4, 1] = "Test123"; //A4*/
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+ //다른 이름으로 저장하기...
|
|
1198
|
+ wb.Save(); // => 오픈한 파일 그대로 저장...
|
|
1199
|
+ /* wb.SaveAs("C:\\Test.xls",
|
|
1200
|
+ Excel.XlFileFormat.xlWorkbookNormal,
|
|
1201
|
+ Type.Missing,
|
|
1202
|
+ Type.Missing,
|
|
1203
|
+ Type.Missing,
|
|
1204
|
+ Type.Missing,
|
|
1205
|
+ Excel.XlSaveAsAccessMode.xlNoChange,
|
|
1206
|
+ Type.Missing,
|
|
1207
|
+ Type.Missing,
|
|
1208
|
+ Type.Missing,
|
|
1209
|
+ Type.Missing,
|
|
1210
|
+ Type.Missing);
|
|
1211
|
+ */
|
|
1212
|
+ //파일 닫기...
|
|
1213
|
+ wb.Close(false, Type.Missing, Type.Missing);
|
|
1214
|
+ wb = null;
|
|
1215
|
+ ExcelApp.Quit();
|
|
1216
|
+ }
|
|
1217
|
+ catch (Exception ex)
|
|
1218
|
+ {
|
|
1219
|
+ //객체들 메모리 해제
|
|
1220
|
+ ReleaseExcelObject(ws);
|
|
1221
|
+ ReleaseExcelObject(wb);
|
|
1222
|
+ ReleaseExcelObject(ExcelApp);
|
|
1223
|
+ GC.Collect();
|
|
1224
|
+ }
|
|
1225
|
+ finally
|
|
1226
|
+ {
|
|
1227
|
+ //객체들 메모리 해제
|
|
1228
|
+ ReleaseExcelObject(ws);
|
|
1229
|
+ ReleaseExcelObject(wb);
|
|
1230
|
+ ReleaseExcelObject(ExcelApp);
|
|
1231
|
+ GC.Collect();
|
|
1232
|
+ }
|
|
1233
|
+ }
|
734
|
1234
|
private void ReleaseExcelObject(object obj)
|
735
|
1235
|
{
|
736
|
1236
|
try
|
|
@@ -779,5 +1279,110 @@ namespace APL_TestCheck
|
779
|
1279
|
return;
|
780
|
1280
|
}
|
781
|
1281
|
}
|
|
1282
|
+
|
|
1283
|
+ private void button_PrevFile_Click(object sender, EventArgs e)
|
|
1284
|
+ {
|
|
1285
|
+
|
|
1286
|
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
1287
|
+ {
|
|
1288
|
+ foreach (string x in openFileDialog.FileNames)
|
|
1289
|
+ {
|
|
1290
|
+ listBox_PreviousFile.Items.Add(x);
|
|
1291
|
+ }
|
|
1292
|
+ }
|
|
1293
|
+ }
|
|
1294
|
+
|
|
1295
|
+ private void button_AfterFile_Click(object sender, EventArgs e)
|
|
1296
|
+ {
|
|
1297
|
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
1298
|
+ {
|
|
1299
|
+ foreach (string x in openFileDialog.FileNames)
|
|
1300
|
+ {
|
|
1301
|
+ listBox_AfterFile.Items.Add(x);
|
|
1302
|
+ }
|
|
1303
|
+ }
|
|
1304
|
+ }
|
|
1305
|
+
|
|
1306
|
+ private void label_Merge_Click(object sender, EventArgs e)
|
|
1307
|
+ {
|
|
1308
|
+ panel_GpsTest.Visible = false;
|
|
1309
|
+ panel_SensorTest.Visible = false;
|
|
1310
|
+ panel_Catm1Test.Visible = false;
|
|
1311
|
+ panel_MergeMain.Visible = true;
|
|
1312
|
+ panel_SnCheckMain.Visible = false;
|
|
1313
|
+ }
|
|
1314
|
+
|
|
1315
|
+ private void label_SnCheck_Click(object sender, EventArgs e)
|
|
1316
|
+ {
|
|
1317
|
+ panel_GpsTest.Visible = false;
|
|
1318
|
+ panel_SensorTest.Visible = false;
|
|
1319
|
+ panel_Catm1Test.Visible = false;
|
|
1320
|
+ panel_MergeMain.Visible = false;
|
|
1321
|
+ panel_SnCheckMain.Visible = true;
|
|
1322
|
+ }
|
|
1323
|
+
|
|
1324
|
+ private void button_FileFindLoad_Click(object sender, EventArgs e)
|
|
1325
|
+ {
|
|
1326
|
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
1327
|
+ {
|
|
1328
|
+ /*foreach (string x in openFileDialog.FileNames)
|
|
1329
|
+ {
|
|
1330
|
+ listBox_Previous.Items.Add(x);
|
|
1331
|
+ }*/
|
|
1332
|
+ }
|
|
1333
|
+ }
|
|
1334
|
+
|
|
1335
|
+ private void button_Merge_Click(object sender, EventArgs e)
|
|
1336
|
+ {
|
|
1337
|
+ OpenExcelFile(listBox_PreviousFile.Items[0].ToString());
|
|
1338
|
+ }
|
|
1339
|
+ #region
|
|
1340
|
+ /// <summary>
|
|
1341
|
+ /// 엑셀 정식 파일 형식이 아닌 파일 읽기
|
|
1342
|
+ /// </summary>
|
|
1343
|
+ /// <param name="FileName">파일명.확장자</param>
|
|
1344
|
+ /// <returns></returns>
|
|
1345
|
+
|
|
1346
|
+ public void OpenExcelFile(string FileName)
|
|
1347
|
+ {
|
|
1348
|
+
|
|
1349
|
+ Excel.Application excelApp = new Excel.Application();
|
|
1350
|
+ Excel.Workbook workbook;
|
|
1351
|
+ Excel.Worksheet worksheet;
|
|
1352
|
+ Excel.Range range;
|
|
1353
|
+ workbook = excelApp.Workbooks.Open(FileName); //Environment.CurrentDirectory+ "\\Excel.xlsx");
|
|
1354
|
+ worksheet = (Excel.Worksheet)workbook.Sheets["Sheet1"];
|
|
1355
|
+ try
|
|
1356
|
+ {
|
|
1357
|
+ //MessageWrite(LogTraceLevel.Info, "OpenExcelFile 함수가 시작 되었습니다.", exception);
|
|
1358
|
+
|
|
1359
|
+ int column = 0;
|
|
1360
|
+ int row = 0;
|
|
1361
|
+ string sTmpColumnName = "SKT 일련번호";
|
|
1362
|
+ string[] colHeader = sTmpColumnName.Split(',');
|
|
1363
|
+
|
|
1364
|
+ range = worksheet.UsedRange;
|
|
1365
|
+ String data = "";
|
|
1366
|
+ data += ((range.Cells[4, 5] as Excel.Range).Value2.ToString() + " ");
|
|
1367
|
+ /* for (int i = 1; i <= range.Rows.Count; ++i)
|
|
1368
|
+ {
|
|
1369
|
+ for (int j = 1; j <= range.Columns.Count; ++j)
|
|
1370
|
+ {
|
|
1371
|
+ data += ((range.Cells[i, j] as Excel.Range).Value2.ToString() + " ");
|
|
1372
|
+ }
|
|
1373
|
+ data += "\n";
|
|
1374
|
+ }*/
|
|
1375
|
+ workbook.Close(false, Type.Missing, Type.Missing);
|
|
1376
|
+ excelApp.Quit();
|
|
1377
|
+ //MessageBox.Show("OpenExcelFile 함수가 종료 되었습니다.");
|
|
1378
|
+ }
|
|
1379
|
+ catch (Exception ex)
|
|
1380
|
+ {
|
|
1381
|
+ MessageBox.Show("OpenExcelFile오류가 발생되었습니다.[{0}]");
|
|
1382
|
+ excelApp.Quit();
|
|
1383
|
+ //throw new Exception(ex.Message);
|
|
1384
|
+ }
|
|
1385
|
+ }
|
|
1386
|
+ #endregion
|
782
|
1387
|
}
|
783
|
1388
|
}
|