So I'm not particularly savvy with threading and async operations in C#, but I'm working on a mesh tool for my asset pipeline and would like to handle these things a little more elegantly. Particularly I'd like to maintain a responsive UI at all times and maybe even get some active feedback on what's going on. My first attempt was to make my loading function asynchronous.
public static void LoadObjectFileAsync(string filename, Action<Mesh> callback)
BackgroundWorker bw = new BackgroundWorker();
bw.DoWork += (object sender, DoWorkEventArgs e) =>
Unfortunately, if I try and do anything useful in the callback method, like update my UI I get a cross-thread operation error.