private void 捕获包统计ToolStripMenuItem_Click(object sender, EventArgs e) { Hashtable ht = new Hashtable(); for (int i = 0; i < listViewMain.Items.Count; i++) { string tmpProtocal = listViewMain.Items[i].SubItems[4].Text; if (!ht.ContainsKey(tmpProtocal)) { ht.Add(tmpProtocal, 1); } else { int count = (int)ht[tmpProtocal]; count++; ht[tmpProtocal] = count; } } //HashTalbe转换为数组 packetKind[] result = new packetKind[ht.Count]; int arrayIndex = 0; foreach (Object obj in ht.Keys) { result[arrayIndex].protocol = obj.ToString(); result[arrayIndex].count = (int)ht[obj]; arrayIndex++; } statisticForm frm = new statisticForm(result); frm.Show(); }
private void 网络状况统计ToolStripMenuItem_Click(object sender, EventArgs e) { statisticForm frm = new statisticForm(); frm.Show(); }