Пример #1
0
    private void AddMessage(string msg, MessageType msgType, MessageSource src)
    {
      if (InvokeRequired)
      {
        BeginInvoke(new AddMessageDelegate(AddMessage), new object[] { msg, msgType, src });
      }
      else
      {
        string source = "Global";
        if (src != null)
          source = src.Source;

        if (msgType != MessageType.Note)
        {
          ListViewItem lvi = new ListViewItem(new string[] { source, msg }, msgType.ToString());

          lvi.Tag = src;
          Items.Add(lvi);
          while (Items.Count > maxEntries)
            Items.RemoveAt(0);
          EnsureVisible(lvi.Index);
        }

        if (logStreamWriter != null)
        {
          logStreamWriter.WriteLine(DateTime.Now.ToString() + ": " + source + "; " + msgType.ToString() + "; " + msg);
          logStreamWriter.Flush();
        }
      }
    }
Пример #2
0
        private void AddMessage(string msg, MessageType msgType, MessageSource src)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new AddMessageDelegate(AddMessage), new object[] { msg, msgType, src });
            }
            else
            {
                string source = "Global";
                if (src != null)
                {
                    source = src.Source;
                }

                if (msgType != MessageType.Note)
                {
                    ListViewItem lvi = new ListViewItem(new string[] { source, msg }, msgType.ToString());

                    lvi.Tag = src;
                    Items.Add(lvi);
                    while (Items.Count > maxEntries)
                    {
                        Items.RemoveAt(0);
                    }
                    EnsureVisible(lvi.Index);
                }

                if (logStreamWriter != null)
                {
                    logStreamWriter.WriteLine(DateTime.Now.ToString() + ": " + source + "; " + msgType.ToString() + "; " + msg);
                    logStreamWriter.Flush();
                }
            }
        }
Пример #3
0
        public void Message(string msg, MessageType msgType)
        {
            MessageSource src = null;

            if (sourceStack.Count != 0)
            {
                src = sourceStack.Peek();
            }
            AddMessage(msg, msgType, src);
        }
Пример #4
0
 public void SetSource(MessageSource src)
 {
   logView.SetSource(src);
 }
Пример #5
0
 public void Message(string msg, MessageType msgType, MessageSource src)
 {
   logView.Message(msg, msgType, src);
 }
Пример #6
0
 public void SetSource(MessageSource src)
 {
   sourceStack.Push(src);
 }
Пример #7
0
 public void SetSource(MessageSource src)
 {
     sourceStack.Push(src);
 }
Пример #8
0
 public void Message(string msg, MessageType msgType, MessageSource src)
 {
     AddMessage(msg, msgType, src);
 }