Open kiddailey opened 1 year ago
I have a working version of async implemented and will submit a pull request as soon as I have completed testing. Instead of providing both sync/async though, I just implemented async all the way down.
FYI - yield is a blocking statement and you can't await an IEnumerable in anything prior to C#8 anyway, so I had to rework the main Scanner.Scan() loop to make it awaitable. It's less cool, but works and is still compatible with Framework 2.x/Net4.x/C#5.
I've also got the cancellation token stuff from #6 working. Just refactoring, putting the finishing touches on, and going to test a bit more.
Title says it all. Currently, everything is written synchronously and blocks UI. To work around this in my app I usually wrap in an async thread and managed it myself, but it would be nice for async to be built in so that I can simply await as needed.
I would recommend making this an additive change though. In other words, do not remove the synchronous versions but rather add equivalent calls with "Async" appended to the method names. For example:
This also probably relates to issue #6 or at least could be implemented together along with that.