.net - Implementing a delayed execution task with cancellation -
i have situation want allow user type wpf textbox, on each keystroke call onpropertychanged , push binding source (using sourceupdatedtrigger=propertychanged) want there short delay before attempting process data (say... 1 second) think of spell check system waits user stop typing before telling them can't spell.
my issue is:
await taskex.delay(1000, cts.token); await taskex.runex(pollasync, cts.token);
works fine until cancel, cancelation token source permanantly in "cancelation requested" state, , have reinstanciate cts... seems... fundamentally wrong... there better way "reset" cts, yet still notify existing tokens should cancel?
no, cancellationtokensource
can cancelled once - say, need create new 1 after you've cancelled it, further tasks.
Comments
Post a Comment