상속: System.EventArgs
예제 #1
0
파일: FileLog.cs 프로젝트: rsdn/janus
		protected void OnLog(object sender, LogEventArgs a)
		{
			try
			{
				if (Config.Instance.UseFileLog && a.Item.Type != LogEventType.Track)
					using (var sw =
							new StreamWriter(new FileStream(Config.Instance.LogFileName,
								FileMode.Append,
								FileAccess.Write,
								FileShare.Read),
							Encoding.GetEncoding(1251)))
					{
						sw.Write(logTypeMessages[(int)a.Item.Type]);
						sw.WriteLine(a.Item.Message);
					}
			}
//{{{-EmptyGeneralCatchClause
			catch (Exception)
//{{{+EmptyGeneralCatchClause
			{
				//hmm... we can't even create log file. And we shouldn't
				//disturb user every log message with message box.
				//so just ignore it for now.
			}
		}
예제 #2
0
파일: LogComboBox.cs 프로젝트: rsdn/janus
		public void AddItem(object sender, LogEventArgs e)
		{
			MethodInvoker mi =
				() =>
				{
					if (e.Item.Type == LogEventType.Track)
						return;
					Items.Insert(0, e.Item);
					SelectedIndex = 0;
					TopIndex = 0;
				};

			if (InvokeRequired)
				Invoke(mi);
			else
				mi();
		}