/// <summary> /// Calculates the stat chart values on the selected message components. /// </summary> /// <returns>The list of GraphItems to display in the chart.</returns> private List <GraphItems> ProcessStatChartItems() { try { List <GraphItems> gItems = new List <GraphItems>(); foreach (string m in Messages) { HL7Lib.Base.Message msg = new HL7Lib.Base.Message(m); List <HL7Lib.Base.Component> coms = msg.GetByID(componentID); if (coms != null && coms.Count == 1) { GraphItems gi = GraphItems.GetGraphItem(gItems, coms[0].Value); if (gi != null) { gItems.Remove(gi); int count = gi.Count + 1; gi = new GraphItems(coms[0].Value, count); gItems.Add(gi); } else { gi = new GraphItems(coms[0].Value, 1); gItems.Add(gi); } } } return(gItems); } catch (Exception ex) { Log.LogException(ex).ShowDialog(); return(new List <GraphItems>()); } }
/// <summary> /// Pulls the specified GraphItem from a list /// </summary> /// <param name="items">The list to search</param> /// <param name="_Name">The name of the GraphItem to find</param> /// <returns>The GraphItem that was found.</returns> public static GraphItems GetGraphItem(List <GraphItems> items, string _Name) { GraphItems gi = items.Find(delegate(GraphItems g) { return(g.Name == _Name); }); return(gi); }