void SaveCaptureItems(CaptureItem ci, Event e, DataTable dt) { string adr = "/GeneratedData/GeneratedEvents/Event||" + e.id.ToString("00") + "/Capture/Item"; int id = DataTable_Functions.TrakHound.GetUnusedAddressId(adr, dt); adr = adr + "||" + id.ToString("00"); ci.id = id; // Save Root string attr = ""; attr += "id||" + ci.id.ToString("00") + ";"; attr += "name||" + ci.name.Replace(' ', '_').ToLower() + ";"; string link = ci.link; List <CollectedItem> linkitems = CollectedItems.ToList(); CollectedItem dataitem = linkitems.Find(x => x.Display == link); if (dataitem != null) { link = dataitem.Id; } attr += "link||" + link + ";"; DataTable_Functions.UpdateTableValue(dt, "address", adr, "attributes", attr); }
void CaptureItem_UpdateCollectedLink(Controls.CaptureItem item) { Page.CollectedItem ci = CollectedItems.ToList().Find(x => x.Id == item.link_COMBO.Text); if (ci != null) { item.link_COMBO.Text = ci.Display; } }
void SaveTrigger(Trigger t, Value v, Event e, DataTable dt, string addressPrefix) { if (t.link != null && t.modifier != null) { string adr = addressPrefix + "/Trigger"; int id = DataTable_Functions.TrakHound.GetUnusedAddressId(adr, dt); adr = adr + "||" + id.ToString("00"); t.id = id; // Save Root string attr = ""; attr += "id||" + t.id.ToString("00") + ";"; string link = t.link; List <CollectedItem> linkitems = CollectedItems.ToList(); CollectedItem dataitem = linkitems.Find(x => x.Display == link); if (dataitem != null) { link = dataitem.Id; } attr += "link||" + link + ";"; attr += "link_type||" + t.linkType + ";"; if (t.modifier != null) { switch (t.modifier) { case "Not Equal To": attr += "modifier||" + "not" + ";"; break; case "Greater Than": attr += "modifier||" + "greater_than" + ";"; break; case "Less Than": attr += "modifier||" + "less_than" + ";"; break; case "Contains": attr += "modifier||" + "contains" + ";"; break; case "Contains Match Case": attr += "modifier||" + "contains_match_case" + ";"; break; case "Contains Whole Word": attr += "modifier||" + "contains_whole_word" + ";"; break; case "Contains Whole Word Match Case": attr += "modifier||" + "contains_whole_word_match_case" + ";"; break; } } attr += "value||" + t.value + ";"; DataTable_Functions.UpdateTableValue(dt, "address", adr, "attributes", attr); } }
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 }); } } }