Activating a custom new window for debugging in visual studio

in the code below. I show information about my application if there is something that has not been installed (... in one of the classes or methods) a window with the current message that is missing is correctly displayed.

there is only one problem, I’m wondering how and how to do it, the application is frozen during debugging, so I can’t move the window or click on it,

is there any workaround that you think of , could i apply?

void SomeMainThreadMethod()
{
    new System.Threading.Thread(() => ProcessSomeLongRunningTask()).Start();
}
//then from another helper class
void ProcessSomeLongRunningTask()
{
    Application.Current.Dispatcher.Invoke(new Action(() =>CustomW.MsgBoxShow(" Title ", "Msg")), System.Windows.Threading.DispatcherPriority.Normal);
}
+4
source share
1 answer

, , , .

, , , , , .

, , , , ,

       public void LongProcess()
       {
            Thread t = new Thread(new ThreadStart(
            delegate
               {

                //Complex code goes here

               this.Dispatcher.Invoke((Action)(() =>
               {

                  //Any requests for controls or variables that you need
                  //from the main application running on the main dispatcher
                  //goes here

               }));


                //Finally once you've got the information to return to
                //your user call a message box here and populate the 
                //message accordingly.

                MessageBox.Show("", "");

                //If a message box fails or isn't good enough
                //create your own user control and call it here like:

                usrConMessage msg = new usrConMessage();
                msg.strTitle = "Whatever";
                msg.strContent = "Whatever";
                msg.show(); //Not a dialog so doesn't steal focus

                //That is normally how I would go about providing a
                //unique and polished user experience.

               }
             ));
            t.Start();
      }
+2

Source: https://habr.com/ru/post/1627811/


All Articles