public static Dictionary<string, FixTag> ReadTags(XmlNode parentNode) { var dic = new Dictionary<string, FixTag>(); foreach (XmlElement node in parentNode.ChildNodes) { var tag = new FixTag(); if (node.Attributes["Title"] != null) tag.Title = node.Attributes["Title"].Value; if (node.Attributes["Description"] != null) tag.Description = node.Attributes["Description"].Value; if (node.Attributes["URL"] != null) tag.URL = node.Attributes["URL"].Value; if (node.Attributes["Num"] != null) tag.Num = node.Attributes["Num"].Value; dic.Add(tag.Num, tag); } return dic; }
/// <summary> /// показать суммарный подтвержденный объем /// </summary> private void GridLogSelectionChanged(object sender, EventArgs e) { var dicVolmBySmb = new Dictionary<string, int>(); var usedIndicies = new List<int>(); foreach (DataGridViewCell cell in gridLog.SelectedCells) { var rowIndex = cell.RowIndex; if (usedIndicies.Contains(rowIndex)) continue; usedIndicies.Add(rowIndex); var row = gridLog.Rows[rowIndex]; var msg = (FixMessage) row.DataBoundItem; if (msg.ResultVolume == 0) continue; if (dicVolmBySmb.ContainsKey(msg.ResultSymbol)) dicVolmBySmb[msg.ResultSymbol] = dicVolmBySmb[msg.ResultSymbol] + msg.ResultVolume; else dicVolmBySmb.Add(msg.ResultSymbol, msg.ResultVolume); } var sb = new StringBuilder(); foreach (var pair in dicVolmBySmb) sb.AppendFormat("{0}: {1} ", pair.Key, pair.Value); lbVolumeBySmb.Text = sb.ToString(); }