using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; namespace AIRS { /// /// App.xaml 的交互逻辑 /// public partial class App : Application { System.Threading.Mutex mutex; public App() { this.Startup += new StartupEventHandler(App_Startup); } void App_Startup(object sender, StartupEventArgs e) { bool ret; mutex = new System.Threading.Mutex(true, "AIRS", out ret); if (!ret) { MessageBox.Show("已有一个程序实例正在运行","提示",MessageBoxButton.OK,MessageBoxImage.Error); Environment.Exit(0); } } } }