c# - activating a custom new window while debuging in visual studio -


in code below show information on application , if there not set (...in 1 of classes or methods) correctly window pops current message telling missing .

there 1 problem wonder if , how done, application frozen while still debugging can not move window or click on it's control,

is there workaround think of apply ?

void somemainthreadmethod() {     new system.threading.thread(() => processsomelongrunningtask()).start(); } //then helper class void processsomelongrunningtask() {     application.current.dispatcher.invoke(new action(() =>customw.msgboxshow(" title ", "msg")), system.windows.threading.dispatcherpriority.normal); } 

the issue here you're processing message box on main dispatcher thread , know defaults dialog box , steals focus main application window.

so try executing message box in new thread create or create own custom user control same features message box won't inherit tools behavior.

you can still run secondary thread created, remember wrap interacts objects made main dispatcher delegate action

       public void longprocess()        {             thread t = new thread(new threadstart(             delegate                {                  //complex code goes here                 this.dispatcher.invoke((action)(() =>                {                    //any requests controls or variables need                   //from main application running on main dispatcher                   //goes here                 }));                   //finally once you've got information return                 //your user call message box here , populate                  //message accordingly.                  messagebox.show("", "");                  //if message box fails or isn't enough                 //create own user control , call here like:                  usrconmessage msg = new usrconmessage();                 msg.strtitle = "whatever";                 msg.strcontent = "whatever";                 msg.show(); //not dialog doesn't steal focus                  //that how go providing                 //unique , polished user experience.                 }              ));             t.start();       } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -