Application.Current.Shutdown() is not killing my application

后端 未结 7 837
执念已碎
执念已碎 2021-02-05 03:39

I\'ve just started a new C#/WPF application and am using the NotifyIcon from the WPF Contrib project. I can start the program, add an \"Exit\" MenuItem to the NotifyIcon\'s Cont

7条回答
  •  故里飘歌
    2021-02-05 04:30

    I found if I create threads that are not set to "background", the main window/etc will close, but the threads will keep runnings.

    In other words, only background threads close themselves when the main thread ends. Regular threads, aka Thread.IsBackground = false, will keep the process running.

    Try using thread.IsBackground = true;

    P.S. I made the assumption that you used threads somewhere.

提交回复
热议问题