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; } }
public void AddLog(string message, enLogType type) { var logElement = new LogElement(message, type); AddLog(logElement); }