示例#1
0
        public void AddLogMessage(string message, MessageSeverity severity)
        {
            WriteLine(message);
            // Raise an event to any listeners that want to so something else with the message
            LogMessageArgs e = new LogMessageArgs(message, severity);

            LogMessage(this, e);
        }
示例#2
0
        private void AddMessageToListView(ListView lvwTargetListView, LogMessageArgs e)
        {
            ListViewItem lvi = new ListViewItem();
            Color        rowColour;

            lvi.Text = e.Message;
            switch (e.Severity)
            {
            case Log.MessageSeverity.Error:
                rowColour = Color.Red;
                break;

            case Log.MessageSeverity.Warning:
                rowColour = Color.Orange;
                break;

            case Log.MessageSeverity.Info:
                rowColour = Color.Green;
                break;

            default:
                rowColour = Color.Black;
                break;
            }

            lvi.ForeColor = rowColour;

            if (lvwTargetListView.InvokeRequired)
            {
                lvwTargetListView.Invoke(new Action(() => lvwTargetListView.Items.Add(lvi)));
            }
            else
            {
                lvwTargetListView.Items.Add(lvi);
            }
        }
示例#3
0
 private void OnSQLLogMessage(object sender, LogMessageArgs e)
 {
     AddMessageToListView(lvwFixSQL, e);
 }
示例#4
0
 private void OnStatusLogMessage(object sender, LogMessageArgs e)
 {
     AddMessageToListView(lvwStatus, e);
 }