From 538f566557cf469e9129d374ff10864b3999609b Mon Sep 17 00:00:00 2001 From: Thomas Nind Date: Fri, 14 May 2021 08:38:20 +0100 Subject: [PATCH 1/5] Added refresh timers to reviewer progress dialogs --- .../MainWindow.cs | 19 ++++++++++++++----- .../Views/RulesView.cs | 16 +++++++++++++--- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs b/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs index 74f70c23e..d34e7721e 100644 --- a/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs +++ b/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs @@ -407,6 +407,14 @@ private void OpenReport(string path, Action exceptionHandler) Width = Dim.Fill() }; dlg.Add(rows); + bool done = false; + + var refresh = Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(1),(s) => + { + dlg.SetNeedsDisplay(); + return !done; + }); + Task.Run(()=>{ try { @@ -425,13 +433,14 @@ private void OpenReport(string path, Action exceptionHandler) } ).ContinueWith((t)=>{ - btn.Clicked -= cancelFunc; - btn.Text = "Done"; - btn.Clicked += closeFunc; - dlg.SetNeedsDisplay(); + btn.Clicked -= cancelFunc; + btn.Text = "Done"; + btn.Clicked += closeFunc; + Application.MainLoop.RemoveTimeout(refresh); + done = true; - cts.Dispose(); + cts.Dispose(); }); Application.Run(dlg); diff --git a/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs b/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs index 1fc154845..f85f2907e 100644 --- a/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs +++ b/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs @@ -320,7 +320,16 @@ private void EvaluateRuleCoverage() dlg.Add(stage); dlg.Add(progress); dlg.Add(textProgress); - + + + bool done = false; + + var refresh = Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(1), (s) => + { + dlg.SetNeedsDisplay(); + return !done; + }); + Task.Run(()=>{ EvaluateRuleCoverageAsync(stage,progress,textProgress,cts.Token,colliding,ignore,update,outstanding); },cts.Token).ContinueWith((t)=>{ @@ -328,10 +337,11 @@ private void EvaluateRuleCoverage() btn.Clicked -= cancelFunc; btn.Text = "Done"; btn.Clicked += closeFunc; - dlg.SetNeedsDisplay(); + Application.MainLoop.RemoveTimeout(refresh); + done = true; cts.Dispose(); - });; + }); Application.Run(dlg); } From 5f4ab060c73b4526fe2cc8f6d1557a7df013540a Mon Sep 17 00:00:00 2001 From: Thomas Nind Date: Fri, 14 May 2021 08:40:35 +0100 Subject: [PATCH 2/5] Added tree branch refresh when selection changes --- .../Applications.IsIdentifiableReviewer/Views/RulesView.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs b/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs index f85f2907e..5b6943810 100644 --- a/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs +++ b/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs @@ -65,6 +65,11 @@ public RulesView() private void _treeView_SelectionChanged(object sender, SelectionChangedEventArgs e) { + if(e.NewValue != null) + { + e.Tree.RefreshObject(e.NewValue); + } + // when selecting a node if (e.NewValue is OutstandingFailureNode ofn){ From 0b546230e72fdc7553005f25c4d6113b493bf31e Mon Sep 17 00:00:00 2001 From: Thomas Nind Date: Fri, 14 May 2021 09:23:06 +0100 Subject: [PATCH 3/5] Added rebuild tree to RulesView idle timer --- .../Applications.IsIdentifiableReviewer/MainWindow.cs | 2 -- .../Applications.IsIdentifiableReviewer/Views/RulesView.cs | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs b/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs index d34e7721e..c6cd44a07 100644 --- a/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs +++ b/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs @@ -436,8 +436,6 @@ private void OpenReport(string path, Action exceptionHandler) btn.Clicked -= cancelFunc; btn.Text = "Done"; btn.Clicked += closeFunc; - - Application.MainLoop.RemoveTimeout(refresh); done = true; cts.Dispose(); diff --git a/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs b/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs index 5b6943810..27062b4a1 100644 --- a/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs +++ b/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs @@ -331,6 +331,7 @@ private void EvaluateRuleCoverage() var refresh = Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(1), (s) => { + _treeView.RebuildTree(); dlg.SetNeedsDisplay(); return !done; }); @@ -342,9 +343,7 @@ private void EvaluateRuleCoverage() btn.Clicked -= cancelFunc; btn.Text = "Done"; btn.Clicked += closeFunc; - Application.MainLoop.RemoveTimeout(refresh); done = true; - cts.Dispose(); }); From a1493595e6745bac08f7a0030db9849388813486 Mon Sep 17 00:00:00 2001 From: Thomas Nind Date: Fri, 14 May 2021 09:26:18 +0100 Subject: [PATCH 4/5] Added news file --- news/745-bugfix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/745-bugfix.md diff --git a/news/745-bugfix.md b/news/745-bugfix.md new file mode 100644 index 000000000..6c1a14da1 --- /dev/null +++ b/news/745-bugfix.md @@ -0,0 +1 @@ +Fixed reviewer tree view refresh/async code \ No newline at end of file From 6b84e77aa0baaf3d53b3d76713fbb4a9cf1daa52 Mon Sep 17 00:00:00 2001 From: Thomas Nind Date: Fri, 14 May 2021 09:45:04 +0100 Subject: [PATCH 5/5] lgtm fixes --- .../Applications.IsIdentifiableReviewer/MainWindow.cs | 2 +- .../Applications.IsIdentifiableReviewer/Views/RulesView.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs b/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs index c6cd44a07..e497f6a00 100644 --- a/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs +++ b/src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs @@ -409,7 +409,7 @@ private void OpenReport(string path, Action exceptionHandler) bool done = false; - var refresh = Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(1),(s) => + Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(1),(s) => { dlg.SetNeedsDisplay(); return !done; diff --git a/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs b/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs index 27062b4a1..7fb670e7a 100644 --- a/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs +++ b/src/applications/Applications.IsIdentifiableReviewer/Views/RulesView.cs @@ -329,7 +329,7 @@ private void EvaluateRuleCoverage() bool done = false; - var refresh = Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(1), (s) => + Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(1), (s) => { _treeView.RebuildTree(); dlg.SetNeedsDisplay();