C# Application.Restart()不会关闭旧的,而是启动新的

C# Application.Restart()不会关闭旧的,而是启动新的,c#,.net,wpf,kinect,C#,.net,Wpf,Kinect,C#WPF应用程序,Kinect应用程序 System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath); System.Windows.Forms.Application.Exit(); 从页面调用,希望重新启动整个应用程序 System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath); Sy

C#WPF应用程序,Kinect应用程序

System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath);
System.Windows.Forms.Application.Exit();
从页面调用,希望重新启动整个应用程序

System.Diagnostics.Process.Start(System.Windows.Forms.Application.ExecutablePath);
System.Windows.Forms.Application.Exit();
也不关闭旧的一个。为什么?我能做点什么?这是最后一分钟,所以我需要一个黑客解决方案,因为我将在一小时内演示

谢谢。

你可以用这个。 这是关于Wpf的工作

System.Diagnostics.Process.Start(Environment.CurrentDirectory+"\\YourExeName");
Close();

您建议的代码执行与作者代码完全相同的操作。@Silvermind-Environment.Exit将关闭应用程序,然后不会发生其他任何事情。除此之外,
Application.Exit
应已关闭该应用程序。Winforms应用程序对象在此处不合适,它无法停止WPF应用程序。请改用WPF Application.Shutdown()方法。