Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A workaround in the mean time is to use the 3 classes available <a href="http://nlog.codeplex.com/workitem/6272" rel="nofollow">here</a>, then follow this procedure:</p> <ol> <li><p>Import the 3 files into your project</p></li> <li><p>If not already the case, use <code>Project &gt; Add Reference</code> to add references to the WPF assemblies: <code>WindowsBase, PresentationCore, PresentationFramework</code>.</p></li> <li><p>In <code>WpfRichTextBoxTarget.cs</code>, replace lines 188-203 with:</p> <pre><code> //this.TargetRichTextBox.Invoke(new DelSendTheMessageToRichTextBox(this.SendTheMessageToRichTextBox), new object[] { logMessage, matchingRule }); if (System.Windows.Application.Current.Dispatcher.CheckAccess() == false) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =&gt; { SendTheMessageToRichTextBox(logMessage, matchingRule); })); } else { SendTheMessageToRichTextBox(logMessage, matchingRule); } } private static Color GetColorFromString(string color, Brush defaultColor) { if (defaultColor == null) return Color.FromRgb(255, 255, 255); // This will set default background colour to white. if (color == "Empty") { return (Color)colorConverter.ConvertFrom(defaultColor); } return (Color)colorConverter.ConvertFromString(color); } </code></pre></li> <li><p>In your code, configure the new target like this below example:</p></li> </ol> <p>I hope it helps, but it definitely does not seem to be a comprehensive implementation...</p> <pre><code>public void loading() { var target = new WpfRichTextBoxTarget(); target.Name = "console"; target.Layout = "${longdate:useUTC=true}|${level:uppercase=true}|${logger}::${message}"; target.ControlName = "rtbConsole"; // Name of the richtextbox control already on your window target.FormName = "MonitorWindow"; // Name of your window where there is the richtextbox, but it seems it will not really be taken into account, the application mainwindow will be used instead. target.AutoScroll = true; target.MaxLines = 100000; target.UseDefaultRowColoringRules = true; AsyncTargetWrapper asyncWrapper = new AsyncTargetWrapper(); asyncWrapper.Name = "console"; asyncWrapper.WrappedTarget = target; SimpleConfigurator.ConfigureForTargetLogging(asyncWrapper, LogLevel.Trace); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload