Ejemplo n.º 1
0
		private void Cell_LogEvent(object sender, LogEventArgs e)
		{
			OnLog(sender, e);
		}
Ejemplo n.º 2
0
		protected void OnLog(object sender, LogEventArgs e)
		{
			// forward the log event
			if (LogEvent != null)
			{
				LogEvent(sender, e);
			}
		}
Ejemplo n.º 3
0
		private void simulator_LogEvent(object sender, LogEventArgs e)
		{
			if (e.Level >= (LogLevel)tbLogLevel.Value)
			{
				string typeStr;
				var senderAgent = (IAgent)sender;
				if (sender is Tissue)
				{
					switch (((ITissue)sender).Type)
					{
						case TissueType.BoneMarrow: typeStr = "BM"; break;
						case TissueType.LymphNode: typeStr = "LN"; break;
						case TissueType.Thymus: typeStr = "TM"; break;
						default: typeStr = "LT"; break;
					}
				}
				else
				{
					switch (((Cell)sender).Type)
					{
						case CellType.APC: typeStr = "DC"; break;
						default: typeStr = "TH"; break;
					}
				}
				var lvi = new ListViewItem(new string[] 
				{
					Scheduler.Clock.ToString("F4"),
					senderAgent.Address.ToString(),
					typeStr,
					e.Log
				});
				lvLog.Items.Add(lvi);

				if (cbShowLogBox.Checked)
				{
					lvi.EnsureVisible();
				}

				// write the log to file
				logBuffer += "T=" + Scheduler.Clock.ToString("F4") +
					", AGT=" + senderAgent.Address.ToString() +
					", TYPE=" + typeStr + ": " + e.Log + "\n";
				if (logBuffer.Length > 10000)
				{
					logWriter.Write(logBuffer);
					logBuffer = "";
				}
			}
		}