public RichTextBoxFormatter(ThreadSafeRichTextBoxWrapper textboxWrapper, Color foreColor, Color backColor, Font font)
        {
            if (textboxWrapper == null)
            {
                throw new ArgumentNullException("textboxWrapper");
            }
            rtbWrapper = textboxWrapper;

            SaveSettings(foreColor, backColor, font);
            ApplySettings();
        }
 public void ApplyToRichTextBox(ThreadSafeRichTextBoxWrapper rtb)
 {
     if (Font != null)
     {
         rtb.SelectionFont = Font;
     }
     if (BackColor != Color.Empty)
     {
         rtb.SelectionBackColor = BackColor;
     }
     if (ForeColor != Color.Empty)
     {
         rtb.SelectionColor = ForeColor;
     }
 }
        private IDisposable CreateRichTextBoxFormatter(ThreadSafeRichTextBoxWrapper textboxWrapper, Color foreColor, Color backColor, FontStyle style)
        {
            Font font = new Font(textboxWrapper.Font, style);
            RichTextBoxFormatter formatter = new RichTextBoxFormatter(textboxWrapper, foreColor, backColor, font);

            return new DisposableList(formatter, font);
        }
 private IDisposable CreateRichTextBoxFormatter(ThreadSafeRichTextBoxWrapper textboxWrapper, Color foreColor, Color backColor)
 {
     return new RichTextBoxFormatter(textboxWrapper, foreColor, backColor);
 }
 private IDisposable CreateRichTextBoxFormatter(ThreadSafeRichTextBoxWrapper textboxWrapper, Color foreColor)
 {
     return CreateRichTextBoxFormatter(textboxWrapper, foreColor, Color.Empty);
 }
        private IDisposable GetFormat(ThreadSafeRichTextBoxWrapper textboxWrapper, LoggingEvent loggingEvent)
        {
            if (loggingEvent.Level == Level.All)  return new TrivialDisposable();

            if ((loggingEvent.Level == Level.Verbose) || (loggingEvent.Level == Level.Finest))
                return CreateRichTextBoxFormatter(textboxWrapper, Color.Blue);
            if ((loggingEvent.Level == Level.Trace) || (loggingEvent.Level == Level.Finer))
                return CreateRichTextBoxFormatter(textboxWrapper, Color.Blue, FontStyle.Bold | FontStyle.Underline);
            if ((loggingEvent.Level == Level.Debug) || (loggingEvent.Level == Level.Fine))
                return CreateRichTextBoxFormatter(textboxWrapper, Color.Blue, FontStyle.Bold);                
            
            if (loggingEvent.Level == Level.Info) // Black on White
                return new TrivialDisposable();
            
            if (loggingEvent.Level == Level.Notice)
                return CreateRichTextBoxFormatter(textboxWrapper, Color.Orange);
            if (loggingEvent.Level == Level.Warn)
                return CreateRichTextBoxFormatter(textboxWrapper, Color.Orange, FontStyle.Bold);
            
            if (loggingEvent.Level == Level.Error)
                return CreateRichTextBoxFormatter(textboxWrapper, Color.Red);
            if (loggingEvent.Level == Level.Severe)
                return CreateRichTextBoxFormatter(textboxWrapper, Color.Red, FontStyle.Bold);
            if (loggingEvent.Level == Level.Critical)
                return CreateRichTextBoxFormatter(textboxWrapper, Color.Red, FontStyle.Bold|FontStyle.Underline);
            
            if (loggingEvent.Level == Level.Alert)
                return CreateRichTextBoxFormatter(textboxWrapper, Color.White, Color.Red);
            if (loggingEvent.Level == Level.Fatal)                
                return CreateRichTextBoxFormatter(textboxWrapper, Color.White, Color.Red, FontStyle.Bold);
            if (loggingEvent.Level == Level.Emergency)
                return CreateRichTextBoxFormatter(textboxWrapper, Color.White, Color.Red, FontStyle.Bold|FontStyle.Underline);
            
            return new TrivialDisposable();
        }
 private void AppendRich(ThreadSafeRichTextBoxWrapper textboxWrapper, LoggingEvent loggingEvent)
 {
     using (GetFormat(textboxWrapper, loggingEvent)) AppendNormal(textboxWrapper, loggingEvent);
 }
 public RichTextBoxFormatter(ThreadSafeRichTextBoxWrapper textboxWrapper, Color foreColor, Font font) : this(textboxWrapper, foreColor, Color.Empty, font)
 {
 }
 public RichTextBoxFormatter(ThreadSafeRichTextBoxWrapper textboxWrapper, Color foreColor, Color backColor) : this(textboxWrapper, foreColor, backColor, null)
 {
 }