private void LogUpdate(LogResult logResult) { CSMEvent tag; switch (logResult.code) { case LogCode.LOG_EVENT: rootNode = new TreeNode(); rootNode.Tag = logResult.result; tag = (CSMEvent)this.rootNode.Tag; rootNode.Nodes.AddRange(tag.node.ToArray()); // Updating Event checklist if (!lbEvent.Items.Contains(tag.eventInfo.Type)) { this.listEvent.Add(tag.eventInfo.Type); } // Updating Monitor checklist if (!listMonitor.Contains(tag.Monitor)) { listMonitor.Add(tag.Monitor); } //Updating GCID checklist foreach (string gcid in tag.CID) { if (this.dictGCID.ContainsKey(gcid)) { this.dictGCID[gcid].Union(tag.CID); } else { this.dictGCID[gcid] = tag.CID; } if (!listGCID.Contains(gcid)) { listGCID.Add(gcid); } } rootNode.Name = tag.eventInfo.Type; rootNode.Text = String.Format("{0,4}> {1,-25}: {2,-20} ({3,15})", treeLog.Nodes.Count + 1, tag.eventInfo.Type, tag.eventInfo.Cause, tag.eventInfo.TimeStamp); if (tag.Parked) { rootNode.Text = String.Format("{0} <== Parked", rootNode.Text); } rootNode.ForeColor = tag.GetColor(); listNode.Add(rootNode); break; case LogCode.LOG_MODELING: rootNode.BackColor = Color.Lavender; break; case LogCode.LOG_LEG: break; case LogCode.LOG_NOTHING: default: break; } }
public void LogUpdateHandler(LogResult logResult) { if (IsHandleCreated) { Invoke(new EventHandler(delegate { LogUpdate(logResult); })); } else { LogUpdate(logResult); } }