Ejemplo n.º 1
0
		private void RemoveLogMessage(LogMessageItem item)
		{
			LogMessages.Remove(item);

			if (Group != null)
				Group.Items.Remove(item.Item);

			_logListView.Items.Remove(item.Item);
		}
Ejemplo n.º 2
0
		internal LogMessageItem AddLogMessage(LogMessage logMsg)
		{
			LogMessageItem item = new LogMessageItem(this, logMsg);
			item.Enabled = Enabled;
			LogMessages.Add(item);

			// We may remove and add many items, disable the drawing one moment
			_logListView.BeginUpdate();

			// Limit the number of displayed messages if necessary
			if (UserSettings.Instance.MessageCycleCount > 0)
				RemoveExtraLogMessages(UserSettings.Instance.MessageCycleCount);

			// Message
			if (Enabled)
			{
				// Set Previous item
				if (_logListView.Items.Count > 0)
					item.Previous =
						_logListView.Items[_logListView.Items.Count - 1].Tag as LogMessageItem;

				// Add it to the main list
				_logListView.Items.Add(item.Item);

				// Add to the corresponding if necessary

				if (UserSettings.Instance.GroupLogMessages && (Group != null))
					Group.Items.Add(item.Item);

				// Force the item to be visible if necessary
				if (UserSettings.Instance.AutoScrollToLastLog)
				{
					item.Item.EnsureVisible();
				}
			}

			// Hide the item is is not in range or doesn't match the current text search if any
			if (!item.IsLevelInRange() || (_hasSearchedText && !item.HasSearchedText(_searchedText)))
				DisableLogMessage(item);

			// Done!
			_logListView.EndUpdate();

			return item;
		}
Ejemplo n.º 3
0
		private void DisableLogMessage(LogMessageItem item)
		{
			if (!item.Enabled)
				return;

			if (Group != null)
				Group.Items.Remove(item.Item);

			_logListView.Items.Remove(item.Item);

			// Mark the item as disabled
			item.Enabled = false;
		}
Ejemplo n.º 4
0
		private void InsertLogMessageByDate(ListView.ListViewItemCollection items, LogMessageItem refItem)
		{
			// Get previous item
			LogMessageItem prevItem = refItem;
			while ((prevItem != null) && !prevItem.Enabled)
				prevItem = prevItem.Previous;

			int pos = 0;
			if ((prevItem != null) && (prevItem.Item != null))
				pos = items.IndexOf(prevItem.Item) + 1;

			items.Insert(pos, refItem.Item);

			// Mark the item as enabled
			refItem.Enabled = true;
		}
Ejemplo n.º 5
0
		private void EnableLogMessage(LogMessageItem item)
		{
			if (item.Enabled)
				return;

			InsertLogMessageByDate(_logListView.Items, item);

			if (Group != null)
				InsertLogMessageByDate(Group.Items, item);
		}
Ejemplo n.º 6
0
		private void EnableLogMessage(LogMessageItem item, bool enable)
		{
			if ((item.Enabled && enable) || (!item.Enabled && !enable))
				return;

			if (enable)
				EnableLogMessage(item);
			else
				DisableLogMessage(item);
		}