using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; namespace UploadClient { /// /// 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, "UploadClient", out ret); if (!ret) { MessageBox.Show("部署工具只能开启一个"); Environment.Exit(0); } } } }