Determine when resolver update complete

SyntaxEditor for WPF Forum

Posted 8 years ago by Jonathan Reis
Version: 11.1.0545
Avatar
Hello,

I'm using the sample resolver code to determine the return type of a method:

var context = new CSharpContextFactory().CreateContext(...);
var resultSet = context.Resolve();
...

I update the project resolver using the following call as the user updates the code within the syntax editor:

project.SourceFiles.QueueCode(...);

This correctly updates the resolver to reflect any changes the user has made (as seen in the mouse-over info and intelliprompt list). My problem is that I need to resolve the code immediately after calling ...QueueCode(...), and it appears that the QueueCode works on a background thread, so my context.Resolve happens before the resolver has been updated (and therefore fails).

How can I determine when the QueueCode / Resolver update has finished?

Thanks.

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes, QueueCode is on a worker thread. If it wasn't then calls to it would block the UI thread.

The SourceFiles collection has observable events that can be attached to when items are added/removed. The key of the collection will be the path you indicate in QueueCode calls. By using an ItemAdded event handler, you can watch for the file you queued to be done and run the resolve.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.