private void RefreshInterfaces() { mIfList = NetworkManagement.GetAllNetworkInterfaces(); int selectedIdx = -1; if (InterfaceListView.SelectedIndices.Count == 1) { selectedIdx = InterfaceListView.SelectedIndices[0]; } InterfaceListView.Clear(); foreach (NetworkInterface netIf in mIfList) { ListViewItem ifItem = new ListViewItem(netIf.Name); InterfaceListView.Items.Add(ifItem); } if (selectedIdx != -1) { InterfaceListView.Items[selectedIdx].Selected = true; UpdateInterfaceDetails(); } }
private void RefreshButton_Click(object sender, EventArgs e) { RefreshInterfaces(); NetworkManagement.PrintAllInterfaces(); }