Skip to content

Commit 800c749

Browse files
authored
Merge pull request #83 from dojo90/develop
Develop
2 parents 9211780 + a39c406 commit 800c749

6 files changed

Lines changed: 10 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ NlogViewer
2222

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

25-
supported Frameworks: `.NETCoreApp v3.0`, `.NETCoreApp v3.1`, `.NET Framework 4.6.1`
25+
supported Framework: `.NET6`
2626

2727
![NLogViewer][p2]
2828

src/NLogViewer.TestApp/MainWindow.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Diagnostics;
33
using System.Reactive.Linq;
44
using System.Reflection;
5+
using System.Threading;
56
using System.Threading.Tasks;
67
using System.Windows;
78
using System.Windows.Controls;
@@ -37,7 +38,7 @@ public MainWindow()
3738
NLogViewer1.TimeStampResolver = new FooTimeStampResolver();
3839
Stopwatch stopwatch = Stopwatch.StartNew();
3940
Random random = new Random();
40-
Observable.Interval(TimeSpan.FromMilliseconds(200)).ObserveOnDispatcher().Subscribe(l =>
41+
Observable.Interval(TimeSpan.FromMilliseconds(200)).ObserveOn(SynchronizationContext.Current).Subscribe(l =>
4142
{
4243
//if((_CntMessage == 10 || _CntError == 20) && TabControl1.Items.Count > 0)
4344
// TabControl1.Items.RemoveAt(0);

src/NLogViewer.TestApp/NLogViewer.TestApp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
5+
<TargetFramework>net6-windows</TargetFramework>
66
<UseWPF>true</UseWPF>
77
<StartupObject>TestApplication.App</StartupObject>
88
<RootNamespace>TestApplication</RootNamespace>

src/NLogViewer/Helper/AutoSizedGridView.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Reactive.Linq;
3+
using System.Threading;
34
using System.Windows.Controls;
45
using NLog;
56

@@ -20,7 +21,7 @@ protected override void PrepareItem(ListViewItem item)
2021
if (info.LoggerName.Length > _MaxLoggerNameLength)
2122
{
2223
_MaxLoggerNameLength = info.LoggerName.Length;
23-
Observable.Timer(TimeSpan.FromMilliseconds(1)).ObserveOnDispatcher().Subscribe(l =>
24+
Observable.Timer(TimeSpan.FromMilliseconds(1)).ObserveOn(SynchronizationContext.Current).Subscribe(l =>
2425
{
2526
foreach (GridViewColumn column in Columns)
2627
{

src/NLogViewer/NLogViewer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
4+
<TargetFramework>net6-windows</TargetFramework>
55
<UseWPF>true</UseWPF>
66
<RootNamespace>DJ</RootNamespace>
77
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

src/NLogViewer/NLogViewer.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using System.Linq;
55
using System.Reactive.Concurrency;
66
using System.Reactive.Linq;
7+
using System.Threading;
8+
using System.Threading.Tasks;
79
using System.Windows;
810
using System.Windows.Controls;
911
using System.Windows.Data;
@@ -511,7 +513,7 @@ private void _OnLoaded(object sender, RoutedEventArgs e)
511513
ListView.ScrollToEnd();
512514
var target = CacheTarget.GetInstance(targetName: TargetName);
513515

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

0 commit comments

Comments
 (0)