예제 #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);
 }