使用场景:
当我们程序需要通过重启来解决设计缺陷时候并且我们的程序是单例模式
第一步:
公开 System.Threading.Mutex 如:public System.Threading.Mutex mutex;
第二步:
关闭 Mutex (重点就是要把Mutex关掉 )再继续调用我们的正常重启方法
(Application.Current as App).mutex.Close(); System.Diagnostics.Process.Start(System.Windows.Application.ResourceAssembly.Location); Application.Current.Shutdown(); Environment.Exit(0);