forked from wangyx0055/DisklessSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.cs
775 lines (607 loc) · 29.1 KB
/
MainWindow.cs
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
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;
using System.Data.SQLite;
using Win2012WMIiSCSIVhdxManager;
using System.Threading;
namespace NoDiskSystem
{
public partial class MainWindow : Form
{
List<ClientGroup> clientGroupList = new List<ClientGroup>();
List<Client> clientList = new List<Client>();
TreeNode rootNode = new TreeNode("所有分组", IconIndexes.tree, IconIndexes.tree);
TreeNode noNode = new TreeNode("未分组", IconIndexes.tree, IconIndexes.tree);
TFTP tftp;
HTTP http;
Thread tftpThread,httpThread;
public static MainWindow pCurrentWin = null;
public MainWindow()
{
InitializeComponent();
pCurrentWin = this;
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
/**
foreach (DataRowView row in 工作站dataGridView.Rows)
{
if (row["clientName"].ToString() == e.Node.Tag.ToString())
{
}
}
* */
for (int i = 0; i < 工作站dataGridView.Rows.Count; i++)
{
string name = 工作站dataGridView.Rows[i].Cells["名称Column"].Value.ToString();
if (name == e.Node.Tag.ToString())
{
工作站dataGridView.CurrentRow.Selected = false;
工作站dataGridView.Rows[i].Selected = true;
工作站dataGridView.CurrentCell = 工作站dataGridView.Rows[i].Cells[0];
}
}
}
private void 磁盘管理ToolStripMenuItem_Click(object sender, EventArgs e)
{
VdiskTemplateManageWindow vdiskTemplateManageWindow = new VdiskTemplateManageWindow();
vdiskTemplateManageWindow.ShowDialog();
}
private void 选项设置ToolStripMenuItem_Click(object sender, EventArgs e)
{
SystemSetting systemSetting = new SystemSetting();
systemSetting.ShowDialog();
}
private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
{
About about = new About();
about.ShowDialog();
}
private void MainWindow_Load(object sender, EventArgs e)
{
updateTree();
updateDataGrid();
//启动tftp服务
tftp = new TFTP();
tftpThread = new Thread(new ThreadStart(tftp.startTftpServer));
tftpThread.Start();
//启动http服务
http = new HTTP();
httpThread = new Thread(new ThreadStart(http.start));
httpThread.Start();
}
public void updateDataGrid()
{
//DataGridViewImageColumn status = new DataGridViewImageColumn();
//status.DisplayIndex = 0;
//status.HeaderText = "启用";
//status.DataPropertyName = "clientEnable";
//status.ImageLayout = DataGridViewImageCellLayout.Zoom;
//工作站dataGridView.Columns.Insert(0, status);
clientList.Clear();
this.工作站dataGridView.DataSource = null;
工作站dataGridView.CellFormatting += new DataGridViewCellFormattingEventHandler(dgvTestSteps_CellFormatting);
using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
{
using (SQLiteCommand cmd = new SQLiteCommand())
{
cmd.Connection = conn;
conn.Open();
SQLiteHelper sh = new SQLiteHelper(cmd);
DataTable dt = sh.Select("select * from CLIENT;");
Client client;
foreach (DataRow row in dt.Rows)
{
client = new Client();
client.ClientId = row["client_id"].ToString();
client.ClientName = row["client_name"].ToString();
client.ClientIp = row["client_ip"].ToString();
client.ClientNetmask = row["client_netmask"].ToString();
client.ClientGateway = row["client_gateway"].ToString();
client.ClientMac = row["client_mac"].ToString();
client.ClientDns1 = row["client_dns1"].ToString();
client.ClientDns2 = row["client_dns2"].ToString();
client.ClientEnable = row["client_enable"].ToString();
client.ClientSuperEnable = row["client_super_enable"].ToString();
clientList.Add(client);
}
this.工作站dataGridView.AutoGenerateColumns = false;
if (dt.Rows.Count != 0) {
this.工作站dataGridView.DataSource = clientList;
}
//if (工作站dataGridView.Rows.Count > 0) { 工作站dataGridView.CurrentCell = 工作站dataGridView.Rows[0].Cells[0]; }
/**
for (int i = 0; i < 工作站dataGridView.Rows.Count; i++)
{
if (工作站dataGridView.Rows[i].Cells["启用Column"].Value.ToString() == "1")
{
工作站dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen;
}
else {
工作站dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.Gray ;
}
}
* */
conn.Close();
}
}
}
void dgvTestSteps_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (工作站dataGridView.Columns[e.ColumnIndex].HeaderText.Equals("启用"))
{
if (e.Value == null)
{
return;
}
string type = e.Value.ToString();
switch (type)
{
case "1":
e.Value = 分组imageList.Images[IconIndexes.enable];
break;
case "0":
e.Value = 分组imageList.Images[IconIndexes.disable];
break;
}
}
if (工作站dataGridView.Columns[e.ColumnIndex].HeaderText.Equals("超级工作站"))
{
if (e.Value == null)
{
return;
}
string type = e.Value.ToString();
switch (type)
{
case "1":
e.Value = 分组imageList.Images[IconIndexes.super];
break;
case "0":
e.Value = 分组imageList.Images[IconIndexes.general];
break;
}
}
}
public void updateTree()
{
分组treeView.Nodes.Clear();
rootNode.Nodes.Clear();
//root tree
//TreeNode rootNode = new TreeNode("所有分组",IconIndexes.tree, IconIndexes.tree);
rootNode.Tag = "所有分组";
rootNode.Text = "所有分组";
分组treeView.Nodes.Add(rootNode);
TreeNode noNode = new TreeNode("未分组", IconIndexes.tree, IconIndexes.tree);
noNode.Tag = "未分组";
noNode.Text = "未分组";
分组treeView.Nodes.Add(noNode);
//group tree
using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
{
using (SQLiteCommand cmd = new SQLiteCommand())
{
cmd.Connection = conn;
conn.Open();
SQLiteHelper sh = new SQLiteHelper(cmd);
DataTable dt = sh.Select("select * from CLIENT_GROUP;");
DataTable dts = sh.Select("select * from CLIENT;");
ClientGroup tempClientGroup = new ClientGroup();
foreach (DataRow ro in dts.Rows)
{
if (ro["client_group_id"].ToString() == "未分组")
{
TreeNode clientNode = new TreeNode(ro["client_name"].ToString(), IconIndexes.computer, IconIndexes.computer);
clientNode.Tag = ro["client_name"].ToString();
clientNode.Text = ro["client_name"].ToString();
noNode.Nodes.Add(clientNode);
}
}
foreach (DataRow row in dt.Rows)
{
tempClientGroup = new ClientGroup();
tempClientGroup.ClientGroupId = row["client_group_id"].ToString();
tempClientGroup.ClientGroupName = row["client_group_name"].ToString();
TreeNode tempNode = new TreeNode(tempClientGroup.ClientGroupName, IconIndexes.computer, IconIndexes.computer);
tempNode.Tag = tempClientGroup.ClientGroupName;
tempNode.Text = tempClientGroup.ClientGroupName;
//将工作站放入对应的组
foreach (DataRow rows in dts.Rows)
{
string tempGroupId = rows["client_group_id"].ToString();
if (tempGroupId == tempClientGroup.ClientGroupId)
{
TreeNode clientNode = new TreeNode(rows["client_name"].ToString(), IconIndexes.computer, IconIndexes.computer);
clientNode.Tag = rows["client_name"].ToString();
clientNode.Text = rows["client_name"].ToString();
tempNode.Nodes.Add(clientNode);
}
}
//
rootNode.Nodes.Add(tempNode);
clientGroupList.Add(tempClientGroup);
}
conn.Close();
}
}
分组treeView.ExpandAll();
}
private void 添加组toolStripButton_Click(object sender, EventArgs e)
{
ClientGroupAdd clientGroupAdd = new ClientGroupAdd(pCurrentWin);
clientGroupAdd.updateTree += new DelegateUpdateTree(UpdateTree);
clientGroupAdd.ShowDialog();
}
public void UpdateTree(TreeNode node)
{
this.rootNode.Nodes.Add(node);
}
public void UpdateTreeClient(TreeNode node, string tag, Client client)
{
//工作站dataGridView.AutoGenerateColumns = false;
工作站dataGridView.DataSource = null;
clientList.Add(client);
工作站dataGridView.DataSource = clientList;
if (tag == "未分组")
{
foreach (TreeNode n in 分组treeView.Nodes)
{
if (n.Text == "未分组")
{
n.Nodes.Add(node);
}
}
}
else {
foreach (TreeNode n in rootNode.Nodes)
{
if (n.Text == tag)
{
n.Nodes.Add(node);
}
}
}
}
private void 删除组toolStripButton_Click(object sender, EventArgs e)
{
string client_group_name = 分组treeView.SelectedNode.Tag.ToString();;
TreeNode tempNode = 分组treeView.SelectedNode;
if (tempNode.Parent == null) {
return;
}
if (tempNode.Parent.Tag.ToString() != "所有分组") {
return;
}
MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
DialogResult dr = MessageBox.Show("确定要删除选中的分组吗?", "删除分组", messButton);
if (dr == DialogResult.OK)
{
//将节点下的所有的机器分组设置为无分组
foreach (TreeNode node in tempNode.Nodes) {
noNode.Nodes.Add(node);
}
//
tempNode.Remove();
//group tree
using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
{
using (SQLiteCommand cmd = new SQLiteCommand())
{
cmd.Connection = conn;
conn.Open();
SQLiteHelper sh = new SQLiteHelper(cmd);
string sqlstring = "delete from CLIENT_GROUP where client_group_name = '" + client_group_name + "';";
sh.ExecuteScalar(sqlstring);
conn.Close();
}
}
}
}
private void 添加工作站ToolStripMenuItem_Click(object sender, EventArgs e)
{
ClientAdd clientAdd = new ClientAdd();
clientAdd.updateTree += new DelegateUpdateTreeClient(UpdateTreeClient);
clientAdd.ShowDialog();
}
private void 工作站dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void 工作站dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
{
return;
}
string name = 工作站dataGridView.Rows[e.RowIndex].Cells["名称Column"].Value.ToString();
SelectTreeView2(分组treeView, null, name);
/**
foreach (TreeNode n in 分组treeView.Nodes)
{
if (n.Text == name)
{
}
}
* */
}
private void SelectTreeView(TreeView treeView, string selectStr)
{
treeView.Focus();
for (int i = 0; i < treeView.Nodes.Count; i++)
{
for (int j = 0; j < treeView.Nodes[i].Nodes.Count; j++)
{
if (treeView.Nodes[i].Nodes[j].Text == selectStr)
{
treeView.SelectedNode = treeView.Nodes[i].Nodes[j];//选中
//treeView.Nodes[i].Nodes[j].Checked = true;
treeView.Nodes[i].Expand();//展开父级
return;
}
}
}
}
private void SelectTreeView2(TreeView treeView, TreeNode treeNode, string selectStr)
{
if(treeView != null && treeNode == null)
{
treeView.Focus();
for (int i = 0; i < treeView.Nodes.Count; i++)
{
if (treeView.Nodes[i].Tag.ToString() == selectStr)
{
treeView.SelectedNode = treeView.Nodes[i];
}
else {
if (treeView.Nodes[i].Nodes.Count > 0)
{
SelectTreeView2(treeView, treeView.Nodes[i], selectStr);
}
}
}
}
else if (treeView != null && treeNode != null) {
if (treeNode.Tag.ToString() == selectStr)
{
treeView.SelectedNode = treeNode;
}else if(treeNode.Nodes.Count > 0){
for (int j = 0; j < treeNode.Nodes.Count; j++)
{
SelectTreeView2(treeView, treeNode.Nodes[j], selectStr);
}
}
}
}
private void toolStripButton9_Click(object sender, EventArgs e)
{
/**
DataView dv = 工作站dataGridView.DataSource as DataView;
dv.RowFilter = "名称Column like '%" + 过滤toolStripTextBox.Text.Trim() + "%'";
工作站dataGridView.DataSource = dv;
* */
}
private void 编辑工作站ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (工作站dataGridView.Rows.Count == 0 || 工作站dataGridView.SelectedRows == null)
{
return;
}
ClientEdit clientEdit = new ClientEdit(工作站dataGridView);
clientEdit.updateGrid += new DelegateUpdateGrid(UpdateGrid);
clientEdit.ShowDialog();
}
public void UpdateGrid(Client client)
{
}
private void 删除工作站ToolStripMenuItem_Click(object sender, EventArgs e)
{
string client_disk_list_id = "";
string client_word_path = "";
string client_mac = "";
string iscsiURL;
string username;
string password;
IniFile ini = new IniFile(Environment.CurrentDirectory + "\\setting.ini");
iscsiURL = ini.ReadString("IscsiServer", "URL", "");
username = ini.ReadString("IscsiServer", "USERNAME", "");
password = ini.ReadString("IscsiServer", "PASSWORD", "");
if (工作站dataGridView.Rows.Count != 0)
{
MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
DialogResult dr = MessageBox.Show("确定要删除选中的工作站?", "删除工作站", messButton);
if (dr == DialogResult.OK)
{
using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
{
using (SQLiteCommand cmd = new SQLiteCommand())
{
cmd.Connection = conn;
conn.Open();
SQLiteHelper sh = new SQLiteHelper(cmd);
string selectDiskListId = "select * from CLIENT where client_id = '" + 工作站dataGridView.CurrentRow.Cells["IDColumn"].Value + "';";
string deleteClient = "delete from CLIENT where client_id = '" + 工作站dataGridView.CurrentRow.Cells["IDColumn"].Value + "';";
DataTable dtGroup = sh.Select(selectDiskListId);
foreach (DataRow row in dtGroup.Rows)
{
client_disk_list_id = row["client_disk_list_id"].ToString();
client_word_path = row["client_work_path"].ToString();
client_mac = row["client_mac"].ToString();
}
string deleteDiskList = "delete from CLIENT_DISK_LIST where client_disk_list_id = '" + client_disk_list_id + "';";
string selectDiskList = "select * from CLIENT_DISK_LIST where client_disk_list_id = '" + client_disk_list_id + "';";
DataTable dtDiskList = sh.Select(selectDiskList);
//删除磁盘文件
foreach (DataRow row in dtDiskList.Rows)
{
string selectDisk = "select * from VDISK_TEMPLET where disk_id = '" + row["disk_id"].ToString() + "';";
DataTable dtDisk = sh.Select(selectDisk);
foreach (DataRow rowDisk in dtDisk.Rows)
{
DiskManagementData ParamObj = new DiskManagementData(); // TODO: 初始化为适当的值
ParamObj.DevicePath = client_word_path + "\\" + rowDisk["disk_name"].ToString() + "-" + client_mac + ".vhdx"; ;
ParamObj.TargetName = rowDisk["disk_name"].ToString() + "-" + client_mac;
ParamObj.serverURL = iscsiURL;
ParamObj.Username = username;
ParamObj.Password = password;
bool actual;
actual = DiskManager.RemoveDisk(ParamObj);
if (actual == true)
{
//MessageBox.Show("磁盘删除成功!");
}
}
}
sh.ExecuteScalar(deleteDiskList);
sh.ExecuteScalar(deleteClient);
for (int i = 0; i < clientList.Count; i++)
{
if (clientList[i].ClientMac == client_mac)
{
clientList.Remove(clientList[i]);
}
}
this.工作站dataGridView.AutoGenerateColumns = false;
工作站dataGridView.DataSource = null;
工作站dataGridView.DataSource = clientList;
TreeNode node = 分组treeView.SelectedNode;
node.Remove();
conn.Close();
MessageBox.Show("工作站删除完成!");
}
}
}
}
}
private void toolStripButton4_Click(object sender, EventArgs e)
{
using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
{
using (SQLiteCommand cmd = new SQLiteCommand())
{
cmd.Connection = conn;
conn.Open();
SQLiteHelper sh = new SQLiteHelper(cmd);
string enableString = "update CLIENT set client_enable = '1' where client_id = '" + 工作站dataGridView.CurrentRow.Cells["IDColumn"].Value.ToString() + "';";
sh.ExecuteScalar(enableString);
for (int i = 0; i < clientList.Count; i++)
{
if (clientList[i].ClientMac == 工作站dataGridView.CurrentRow.Cells["MACColumn"].Value)
{
clientList[i].ClientEnable = "1";
//工作站dataGridView.CurrentRow.DefaultCellStyle.BackColor = Color.LightGreen;
}
}
this.工作站dataGridView.AutoGenerateColumns = false;
工作站dataGridView.DataSource = null;
工作站dataGridView.DataSource = clientList;
conn.Close();
}
}
}
private void toolStripButton5_Click(object sender, EventArgs e)
{
using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
{
using (SQLiteCommand cmd = new SQLiteCommand())
{
cmd.Connection = conn;
conn.Open();
SQLiteHelper sh = new SQLiteHelper(cmd);
string enableString = "update CLIENT set client_enable = '0' where client_id = '" + 工作站dataGridView.CurrentRow.Cells["IDColumn"].Value.ToString() + "';";
sh.ExecuteScalar(enableString);
for (int i = 0; i < clientList.Count; i++)
{
if (clientList[i].ClientMac == 工作站dataGridView.CurrentRow.Cells["MACColumn"].Value)
{
clientList[i].ClientEnable = "0";
//工作站dataGridView.CurrentRow.DefaultCellStyle.BackColor = Color.Gray;
}
}
this.工作站dataGridView.AutoGenerateColumns = false;
工作站dataGridView.DataSource = null;
工作站dataGridView.DataSource = clientList;
conn.Close();
}
}
}
private void toolStripButton6_Click(object sender, EventArgs e)
{
using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
{
using (SQLiteCommand cmd = new SQLiteCommand())
{
cmd.Connection = conn;
conn.Open();
SQLiteHelper sh = new SQLiteHelper(cmd);
string enableString = "update CLIENT set client_super_enable = '1' where client_id = '" + 工作站dataGridView.CurrentRow.Cells["IDColumn"].Value.ToString() + "';";
string disableString = "update CLIENT set client_super_enable = '0' where client_id != '" + 工作站dataGridView.CurrentRow.Cells["IDColumn"].Value.ToString() + "';";
sh.ExecuteScalar(enableString);
sh.ExecuteScalar(disableString);
for (int i = 0; i < clientList.Count; i++)
{
if (clientList[i].ClientMac == 工作站dataGridView.CurrentRow.Cells["MACColumn"].Value)
{
clientList[i].ClientSuperEnable = "1";
//工作站dataGridView.CurrentRow.DefaultCellStyle.BackColor = Color.LightGreen;
}
else {
clientList[i].ClientSuperEnable = "0";
}
}
this.工作站dataGridView.AutoGenerateColumns = false;
工作站dataGridView.DataSource = null;
工作站dataGridView.DataSource = clientList;
conn.Close();
}
}
}
private void toolStripButton7_Click(object sender, EventArgs e)
{
using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
{
using (SQLiteCommand cmd = new SQLiteCommand())
{
cmd.Connection = conn;
conn.Open();
SQLiteHelper sh = new SQLiteHelper(cmd);
string disableString = "update CLIENT set client_super_enable = '0';";
sh.ExecuteScalar(disableString);
for (int i = 0; i < clientList.Count; i++)
{
clientList[i].ClientSuperEnable = "0";
}
this.工作站dataGridView.AutoGenerateColumns = false;
工作站dataGridView.DataSource = null;
工作站dataGridView.DataSource = clientList;
conn.Close();
}
}
}
private void toolStripButton3_Click(object sender, EventArgs e)
{
string mac = 工作站dataGridView.CurrentRow.Cells["MACColumn"].Value.ToString();
byte[] _mac = new byte[mac.Length / 2];
for (int i = 0; i < _mac.Length; i++)
{
_mac[i] = Convert.ToByte(mac.Substring(i * 2, 2), 16);
}
ClientWakeUp.WakeUp(_mac);
MessageBox.Show("开机请求已发送!");
}
private void MainWindow_FormClosed(object sender, FormClosedEventArgs e)
{
tftpThread.Abort();
httpThread.Abort();
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
updateDataGrid();
updateTree();
}
}
}