示例#1
0
文件: Log.cs 项目: dbremner/szotar
		/// <remarks>Do not call this from another thread. Yet.</remarks>
		public void AddMessage(LogType type, string message, params object[] inserts) {
			var m = new LogMessage {
				Type = type,
				Text = string.Format(CultureInfo.InvariantCulture, message, inserts),
				Time = DateTime.Now
			};

			lock (syncObject) {
				Messages.Add(m);

				if (Messages.Count > MaxLength)
					Messages.RemoveRange(0, Messages.Count / 2);
			}

			RaiseMessageAdded(m);
		}
示例#2
0
文件: Log.cs 项目: dbremner/szotar
		protected void RaiseMessageAdded(LogMessage m) {
			var f = MessageAdded;
			if (f != null)
				f(this, new LogEventArgs(m));
		}
示例#3
0
文件: Log.cs 项目: dbremner/szotar
		public LogEventArgs(LogMessage m) { Message = m; }