c# - Keep focus on main window while doing lengthy operations -
i have wpf application calls dll when user clicks on button. dll lengthy operations , while that, cannot interact mainwindow, e.g scroll down datagrid logging update messages, switch tabs etc. how can keep mainwindow activated while dll running ? thought backgroundworker calls .activate()
method whenever window.deactivated
occurs, wouldn't terribly resource-consuming , slow down other dll takes lot of time ?
i'm waiting suggestions :) thank you
it seems running lengthy operation in ui thread. try running in separate thread.
private void button_click(object sender, routedeventargs e) { task.factory.startnew(calllengthydllmethod); } private void calllengthydllmethod() { thread.sleep(10000); // simulating lengthy operations messagebox.show("done!"); }
Comments
Post a Comment