public void RemoveItem() { if (listViewUsers.InvokeRequired) { RemoveItemDelegate d = RemoveItem; listViewUsers.Invoke(d); } else { bool exist; foreach (ListViewItem itemUser in listViewUsers.Items) { exist = false; foreach (ListViewItem itemResolveNew in resolvedListViewItem) { if (itemUser.Text.Equals(itemResolveNew.Text)) { exist = true; break; } } if (!exist) { listViewUsers.Items.Remove(itemUser); } } } }
public void RemoveItem(ListViewItem lvi) { if (listView1.InvokeRequired) { RemoveItemDelegate d = RemoveItem; listView1.Invoke(d, lvi); } else { listView1.Items.Remove(lvi); } }
/// <summary> /// Public constructor for direct use of this class. /// </summary> /// <param name="compareItemsCallback">Delegate for comparing identity of items in the source and destination collections.</param> /// <param name="addItemCallback">Delegate for adding items to the destination collection.</param> /// <param name="updateItemCallback">Delegate for updating items in the destination collection, or null if items should not be updated.</param> /// <param name="removeCallback">Delegate for removing items from the destination collection, or null if items should not be removed.</param> public CollectionSynchronizeHelper( CompareItemsDelegate compareItemsCallback, AddItemDelegate addItemCallback, UpdateItemDelegate updateItemCallback, RemoveItemDelegate removeCallback) { _compareItemsCallback = compareItemsCallback; _addItemCallback = addItemCallback; _updateItemCallback = updateItemCallback; _removeItemCallback = removeCallback; _allowUpdate = _updateItemCallback != null; _allowRemove = _removeItemCallback != null; }
public ItemViewModel(Item item, RemoveItemDelegate remove = null) { Item = item; RemoveAction = remove; }