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

后端 未结 7 816
执念已碎
执念已碎 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:16

    It may be living in the processes. Here's a sample of how I check / kill the process

           const string str = "MRS_Admin";
            foreach (Process process in Process.GetProcesses())
            {
                if (process.ProcessName.StartsWith(str))
                {
                    Console.WriteLine(@"Killing process " + str);
                    process.Kill();
                }
            }
    

提交回复
热议问题