private void LoadCollectedItems(List <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.ToList()) { if (!newItems.Exists(x => x.Id == item.Id)) { CollectedItems.Remove(item); } } CollectedItems.SupressNotification = true; CollectedItems.Sort(); CollectedItems.SupressNotification = false; }
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 }); } } }
private void LoadCollectedItems(List<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 }); } } }
private void LoadCollectedItems(List<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; }