Skip to content

Commit

Permalink
Multiple LoadJson calls #1831
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Sep 5, 2023
1 parent ed0597a commit 7bc47b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Analogy.CommonControls/Tools/JsonTreeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,11 @@ public async Task ShowJson(string jsonString)
cancellationTokenSource?.Cancel();
cancellationTokenSource = new CancellationTokenSource();
var token = cancellationTokenSource.Token;
object json = JsonConvert.DeserializeObject(jsonString);
var nodes = await Task.Run(() => LoadTree(json, token));
var nodes = await Task.Run(() =>
{
object json = JsonConvert.DeserializeObject(jsonString);
return LoadTree(json, token);
});
if (nodes.valid)
{
Nodes.AddRange(nodes.result.ToArray());
Expand Down

0 comments on commit 7bc47b9

Please sign in to comment.