private void LoadCollectedItems(List <MTConnectDevices.DataItem> dataItems) { var newItems = new List <CollectedItem>(); foreach (var dataItem in dataItems) { var item = new CollectedItem(dataItem); newItems.Add(item.Copy()); } foreach (var newItem in newItems) { if (!CollectedItems.ToList().Exists(x => x.Id == newItem.Id)) { CollectedItems.Add(newItem); } } foreach (var item in CollectedItems) { if (!newItems.Exists(x => x.Id == item.Id)) { CollectedItems.Remove(item); } } CollectedItems.SupressNotification = true; CollectedItems.Sort(); CollectedItems.SupressNotification = false; foreach (Controls.Event ev in events) { foreach (Controls.CaptureItem ci in ev.CaptureItems) { Dispatcher.BeginInvoke(new Action <Controls.CaptureItem>(CaptureItem_UpdateCollectedLink), priority, new object[] { ci }); } } }
//create a method allowing the user to remove an item previously on the list CollectedItems //then add it to NotCollectedItems public void RemoveCollectedItem(string itemName) { CollectedItems.Remove(itemName); NotCollectedItems.Add(itemName); }