示例#1
0
        public void AddLog(LogElement logElement)
        {
            var textRange = new TextRange(textBox.Document.ContentEnd, textBox.Document.ContentEnd)
            {
                Text = $"{logElement.Date.ToShortTimeString()}: \t{logElement.Message}\r"
            };

            switch (logElement.LogType)
            {
            case enLogType.Message:
            case enLogType.Attantion:
                textRange.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Black);
                break;

            case enLogType.Error:
                textRange.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Red);
                break;
            }
        }
示例#2
0
        public void AddLog(string message, enLogType type)
        {
            var logElement = new LogElement(message, type);

            AddLog(logElement);
        }