c# - How to dispatch a lambda expression to a background (non-UI) thread? -
i looking perform action:
deployment.current.dispatcher.begininvoke(() => { ... // ui specific stuff });
but instead of sending lambda expression ui thread, want send background worker.
the situation such, have messagebox response need have know whether or not additional processing (in case copy file).
how can 1 accomplish this? open refactor solution of sorts not include lambda expression dispatch.
thanks reading
messagebox runs on ui thread, when returns modal display, you're on ui thread. dispatching ui dispatcher @ point doesn't make sense.
you'd want run lambda on background thread (e.g., threadpool.queueuserworkitem, via task, etc), when finishes use dispatcher return ui thread. need dispatcher ui thread; not sure if different 1 mention in code.
Comments
Post a Comment