[program-l] Re: General WPF / .NET 5 question: Closing all threads

  • From: <jordyydeweer@xxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Wed, 7 Apr 2021 12:52:29 +0200

Met vriendelijke groeten | Your sincerely | Salutations
Jordy Deweer
+32 497 40 70 01

-----Original Message-----
From: program-l-bounce@xxxxxxxxxxxxx <program-l-bounce@xxxxxxxxxxxxx> On Behalf 
Of Patrick Le Baudour
Sent: Wednesday, April 7, 2021 10:00 AM
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: General WPF / .NET 5 question: Closing all threads

Hi,

Details depend on your exact problem and design, so i'm not sure but two 
possibilities would be:
- if your problem is about some actual threads not closing, setting 
IsBackground as true when creating the thread should solve it.
- If the problem is about windows not closing because of the Closing event  
handling, you could use a static bool property somewhere to check if you want 
the window to actually close.

-- Patrick

Le 06/04/2021 à 20:56, jordyydeweer@xxxxxxxxx a écrit :

Guys

I’m developing a WPF app which has some windows that I hide and show 
according to the needs. I cannot close them, since I have to re-open 
them often and that throws exceptions.

So what I did is create some loader which loads the windows and shows 
them when needed. I also have handled the Closing event to cancel the 
close and just hide the Window.

Now, when I finally close the MainWindow, the application keeps 
running and I cannot figure out how to close it.

This is in WPF and C# using .NET 5.0.

Can anybody help me out in this?

Met vriendelijke groeten | Your sincerely | Salutations Jordy Deweer

DewSystems

info@xxxxxxxxxxxxx <mailto:info@xxxxxxxxxxxxx>

+32 473 39 27 50

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: