Skip to content

Commit

Permalink
Merge pull request #745 from SMI/reviewer-async-fixes
Browse files Browse the repository at this point in the history
Reviewer async fixes
  • Loading branch information
tznind authored May 14, 2021
2 parents 9fb431d + 6b84e77 commit 293bc30
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
1 change: 1 addition & 0 deletions news/745-bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed reviewer tree view refresh/async code
19 changes: 13 additions & 6 deletions src/applications/Applications.IsIdentifiableReviewer/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,14 @@ private void OpenReport(string path, Action<Exception> exceptionHandler)
Width = Dim.Fill() };
dlg.Add(rows);

bool done = false;

Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(1),(s) =>
{
dlg.SetNeedsDisplay();
return !done;
});

Task.Run(()=>{
try
{
Expand All @@ -425,13 +433,12 @@ private void OpenReport(string path, Action<Exception> exceptionHandler)
}
).ContinueWith((t)=>{

btn.Clicked -= cancelFunc;
btn.Text = "Done";
btn.Clicked += closeFunc;
dlg.SetNeedsDisplay();

btn.Clicked -= cancelFunc;
btn.Text = "Done";
btn.Clicked += closeFunc;
done = true;

cts.Dispose();
cts.Dispose();
});

Application.Run(dlg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public RulesView()

private void _treeView_SelectionChanged(object sender, SelectionChangedEventArgs<ITreeNode> e)
{
if(e.NewValue != null)
{
e.Tree.RefreshObject(e.NewValue);
}

// when selecting a node

if (e.NewValue is OutstandingFailureNode ofn){
Expand Down Expand Up @@ -320,18 +325,27 @@ private void EvaluateRuleCoverage()
dlg.Add(stage);
dlg.Add(progress);
dlg.Add(textProgress);



bool done = false;

Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(1), (s) =>
{
_treeView.RebuildTree();
dlg.SetNeedsDisplay();
return !done;
});

Task.Run(()=>{
EvaluateRuleCoverageAsync(stage,progress,textProgress,cts.Token,colliding,ignore,update,outstanding);
},cts.Token).ContinueWith((t)=>{

btn.Clicked -= cancelFunc;
btn.Text = "Done";
btn.Clicked += closeFunc;
dlg.SetNeedsDisplay();

done = true;
cts.Dispose();
});;
});

Application.Run(dlg);
}
Expand Down

0 comments on commit 293bc30

Please sign in to comment.