private void UpdateUI(NETDISPLAY_ENTRY data) { if (this.InvokeRequired) { BeginInvoke(new UpdateUIDeleg(UpdateUI), new object[] { data }); return; } //add to list Debug.WriteLine(String.Format("UI List add {0}", data.device_name)); lv_device.AddEntry(data); }
public bool AddEntry(NETDISPLAY_ENTRY pEntry) { int i; NETDISPLAY_ENTRY pNewEntry; // Find the next available entry for (i = 0; i < MAX_ENTRIES; i++) { if (devicelist[i] == null) { break; } } // If no entries could be found if (i == MAX_ENTRIES) { return false; } //----------------------------- // Add the entry at location i //----------------------------- // Create new entry pNewEntry = new NETDISPLAY_ENTRY(); // Copy the entry data pNewEntry.mode = pEntry.mode; pNewEntry.time_on_powered = pEntry.time_on_powered; pNewEntry.time_on_network = pEntry.time_on_network; pNewEntry.mac = (byte[])pEntry.mac.Clone(); pNewEntry.ip = (byte[])pEntry.ip.Clone(); pNewEntry.port = pEntry.port; pNewEntry.DHCP = pEntry.DHCP; pNewEntry.serverport = pEntry.serverport; pNewEntry.tcptimeout = pEntry.tcptimeout; pNewEntry.device_name = pEntry.device_name; pNewEntry.description = pEntry.description; // Store address in global array devicelist[i] = pNewEntry; // Increment valid cell count m_numcells++; this.Items.Add(" "); // Update the scroll bar, sort, and redraw window return true; }