Hello
I'm making simple application which retrives list of Wi-Fi and print necessary info in the ListView.
public void GetWiFiInfo() { foreach (WlanClient.WlanInterface WiFiInterface in client.Interfaces) { Wlan.WlanAvailableNetwork[] networks = WiFiInterface.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles); foreach (Wlan.WlanAvailableNetwork network in networks) { Wlan.WlanBssEntry[] list = WiFiInterface.GetNetworkBssList(network.dot11Ssid, network.dot11BssType, network.securityEnabled); foreach (Wlan.WlanBssEntry entry in list) { string BSSID = BitConverter.ToString(entry.dot11Bssid); ListViewItem item = new ListViewItem(GetStringForSSID(entry.dot11Ssid)); item.SubItems.Add(BSSID); item.SubItems.Add(entry.rssi.ToString()); item.SubItems.Add(network.dot11DefaultAuthAlgorithm.ToString()); wifiListView.Items.AddRange(new ListViewItem[] { item }); } } } }
So, this is the function which populates ListView.
I've also added timer, which I want to use to update ListView every second (calling this function in timerTick event causes adding items to the listview one after another, e.g. we have 1 network - after 10 secs we have 10 same networks on the list)
The problem is, I have no idea how to do that. List of networks isn't constant (else I could use Items[number].SubItems[number].Text property), becayse if we move, new networks may be in the range, so we need to add another row. Anyone has idea how to update whole list?
I was thinking that maybe there is a way to remove current item and add new one?