Skip to content

Commit

Permalink
Merge pull request #83 from dojo90/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
djonasdev committed Jun 27, 2022
2 parents 9211780 + a39c406 commit 800c749
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ NlogViewer

NlogViewer is a ui control library to visualize NLog logs in your personal application. It is mainly based on [Sentinel][1] and its controls.

supported Frameworks: `.NETCoreApp v3.0`, `.NETCoreApp v3.1`, `.NET Framework 4.6.1`
supported Framework: `.NET6`

![NLogViewer][p2]

Expand Down
3 changes: 2 additions & 1 deletion src/NLogViewer.TestApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Reactive.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
Expand Down Expand Up @@ -37,7 +38,7 @@ public MainWindow()
NLogViewer1.TimeStampResolver = new FooTimeStampResolver();
Stopwatch stopwatch = Stopwatch.StartNew();
Random random = new Random();
Observable.Interval(TimeSpan.FromMilliseconds(200)).ObserveOnDispatcher().Subscribe(l =>
Observable.Interval(TimeSpan.FromMilliseconds(200)).ObserveOn(SynchronizationContext.Current).Subscribe(l =>
{
//if((_CntMessage == 10 || _CntError == 20) && TabControl1.Items.Count > 0)
// TabControl1.Items.RemoveAt(0);
Expand Down
2 changes: 1 addition & 1 deletion src/NLogViewer.TestApp/NLogViewer.TestApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFramework>net6-windows</TargetFramework>
<UseWPF>true</UseWPF>
<StartupObject>TestApplication.App</StartupObject>
<RootNamespace>TestApplication</RootNamespace>
Expand Down
3 changes: 2 additions & 1 deletion src/NLogViewer/Helper/AutoSizedGridView.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Reactive.Linq;
using System.Threading;
using System.Windows.Controls;
using NLog;

Expand All @@ -20,7 +21,7 @@ protected override void PrepareItem(ListViewItem item)
if (info.LoggerName.Length > _MaxLoggerNameLength)
{
_MaxLoggerNameLength = info.LoggerName.Length;
Observable.Timer(TimeSpan.FromMilliseconds(1)).ObserveOnDispatcher().Subscribe(l =>
Observable.Timer(TimeSpan.FromMilliseconds(1)).ObserveOn(SynchronizationContext.Current).Subscribe(l =>
{
foreach (GridViewColumn column in Columns)
{
Expand Down
2 changes: 1 addition & 1 deletion src/NLogViewer/NLogViewer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<TargetFramework>net6-windows</TargetFramework>
<UseWPF>true</UseWPF>
<RootNamespace>DJ</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
4 changes: 3 additions & 1 deletion src/NLogViewer/NLogViewer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.Linq;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
Expand Down Expand Up @@ -511,7 +513,7 @@ private void _OnLoaded(object sender, RoutedEventArgs e)
ListView.ScrollToEnd();
var target = CacheTarget.GetInstance(targetName: TargetName);

_Subscription = target.Cache.SubscribeOn(Scheduler.Default).Buffer(TimeSpan.FromMilliseconds(100)).Where (x => x.Any()).ObserveOnDispatcher(DispatcherPriority.Background).Subscribe(infos =>
_Subscription = target.Cache.SubscribeOn(Scheduler.Default).Buffer(TimeSpan.FromMilliseconds(100)).Where (x => x.Any()).ObserveOn(new DispatcherSynchronizationContext(_ParentWindow.Dispatcher)).Subscribe(infos =>
{
if (Pause) return;
using (LogEvents.DeferRefresh())
Expand Down

0 comments on commit 800c749

Please sign in to comment.